Armine Armine - 1 year ago 122
HTML Question

How to change the font-size of the part of textarea text in HTML,CSS?

My textarea text must have 2 lines and 2 font sizes. I tried to change the font size using span tag but this doesn't work.How to achieve that? Please help.Here is

<textarea class="form-control" rows="5" id="comment">Blah blah blah:&#13;&#10 <span>(blah blah blah)</span></textarea>

Answer Source

You can't have <span>s inside <textarea>s. You also didn't style the span. If you want to use <span>s inside of some editable, use a <div> that's contenteditable. Example:

<div id="comment" contenteditable="true">
    Some text <span style="font-size: 30px">LARGE TEXT</span>

The editable region will lose the border, but you can easily add that. The height and width for the text limits will also need to be set. Here is a fiddle:

Updated fiddle

Here's another fiddle with more styling:

Another fiddle

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download