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/
The browser support is very good as well (IE5.5+). Read more at https://developer.mozilla.org/en-US/docs/Web/HTML/Content_Editable