Armine Armine - 4 months ago 12
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 https://jsfiddle.net/arminemash/ccsa4xf8/1/

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

Answer

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>
</div>

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