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?
example : STACK OVER FLOW just the 'A' letter is red!
Thanks guys
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?
example : STACK OVER FLOW just the 'A' letter is red!
Thanks guys
you could use bold tags A
css:
From css you can only change an elements property so you need to insert the letter "A" in another element like this:
And the CSS part is
Or attach a class to it like this
CSS:
You can't do this with a regular
<input type="text">
or<textarea>
element, but with a normal element (like<div>
or<p>
) madecontenteditable
, you have all the freedoms of html/css formatting.http://jsfiddle.net/jVqDJ/
The browser support is very good as well (IE5.5+). Read more at https://developer.mozilla.org/en-US/docs/Web/HTML/Content_Editable
The question is - what did you mean by "text box"? Did you mean simple text on a page, or editable text like input type="text" or textarea? If you meant simple text, then the previous answers will do the job. But in case of editable text, it is impossible to achieve by css.