我正在设计一个网站,我想问你们,如何通过 CSS 更改 HTML 文本框中字符串中的一个字符的颜色?
I'm designing a web site and i would like to ask you guys that, how can I change the color of just one character in a string in a text box of HTML by CSS?
示例:STACK OVER FLOW 只有A"字母是红色的!
example : STACK OVER FLOW just the 'A' letter is red!
谢谢大家
你不能用常规的 <input type="text"> 或 <textarea> 元素,但使用普通元素(如 <div> 或 <p>)使 contenteditable,你有html/css 格式的所有自由.
You can't do this with a regular <input type="text"> or <textarea> element, but with a normal element (like <div> or <p>) made contenteditable, you have all the freedoms of html/css formatting.
<div contenteditable>
ST<span style="color: red">A</span>CK OVERFLOW
</div>
http://jsfiddle.net/jVqDJ/
浏览器支持也很好(IE5.5+).在 https://developer.mozilla.org/en-US/阅读更多内容docs/Web/HTML/Content_Editable
The browser support is very good as well (IE5.5+). Read more at https://developer.mozilla.org/en-US/docs/Web/HTML/Content_Editable
这篇关于更改文本框 HTML/CSS 中一个字符的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
更改传单标记群集图标颜色,继承其余默认 CSSChanging leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改传单标记群集图标颜色,继承其余默认
如何更改 LeafletJS 中的默认加载磁贴颜色?How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默认加载磁贴颜色?)
html2canvas 捕获除内部画布内容之外的所有内容html2canvas captures everything except the content of an inner canvas(html2canvas 捕获除内部画布内容之外的所有内容)
显示离线 OSM 映射文件.建议:一个带有 Js.library 的Showing an offline OSM map file. Suggestion: an MB Tiles file with Js.library(显示离线 OSM 映射文件.建议:一个带有 Js.library 的 MB Tiles
单击传单标记会将您带到 URLClicking a leaflet marker takes you to URL(单击传单标记会将您带到 URL)
如何在 Leaflet 中显示超出特定缩放级别的标签?How do I show a label beyond a certain zoom level in Leaflet?(如何在 Leaflet 中显示超出特定缩放级别的标签?)