2

I've got a <textarea>, but I need to color specific lines different colors. Apparently, I can't do this.

I could perhaps use a <div>, but I like the look and scrollbar of a <textarea>.

Is there any sort of database of HTML elements somewhere that I can check? It's rather annoying having to burden the posters of StackOverflow whenever I can't place the name of an element.

1 Answer 1

2

Textareas can only contain plain text. No possibility to format via CSS. You need something like a WYSIWYG Editor (CKEditor or TinyMCE)

Or if readonly, filled by javascript: Use a simple div which can contain HTML markup inside for your line colors. Then style it with CSS to look like a textarea (scrollbar maybe)

Sign up to request clarification or add additional context in comments.

6 Comments

Problem is, my Javascript is going to be the only thing writing to it, and the <textarea> will be read only.
Then why don't use a simple div which can contain HTML markup inside for your line colors. Then style it with CSS to look like a textarea (scrollbar maybe)
I suppose I'll give that a shot.
Got it working. If you add the "div" bit to your answer, I'll accept it.
What do you mean with: If you add the "div" bit to your answer, I'll accept it
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.