Fonts in a text box?

In a regular textbox created in Rails:

<%= text_area_tag 'chat_data', '', :rows => 30, :cols => 70 %>  

      

Is it possible to have fonts for text like bold and coloring? I am using a textbox to store a chat session and want to make it more aesthetic.

0


a source to share


2 answers


I would completely forget <textarea>

. Output HTML in <div>

and use CSS to format your markup.

Example:

<div class="chatbox">
    <p><span class="name">Oli:</span> My message</p>
    <p><span class="name">Oli:</span> My message</p>
    <p><span class="name">Oli:</span> My message</p>
    <p><span class="name">Oli:</span> My message</p>
</div>

      



with some of the following formatting:

.chatbox {overflow:auto;width:500px;height:200px}
.chatbox p {}
.chatbox .name {font-weight:bold}

      

It's pretty simple, but you can type it if you know how. (Note: width and height must be locked for overflow to work).

+5


a source


No, It is Immpossible. WYSIWYG editors in HTML use a great attribute trick editable

, not textarea

.



+3


a source







All Articles