tags:

views:

125

answers:

3

How to set the css of a textarea not to be clicked on it.

           <textarea></textarea>

Thanks

+6  A: 

Try

<textarea disabled="yes"></textarea>

In most browsers, this will grey out the content of the textarea though, and the user won't be able to copy any text from within it. If you don't like that, you can use:

<textarea readonly="yes"></textarea>

The textarea will then remain clickable, and the user will still be able to select/copy text within it, but he won't be able to edit it.

RegDwight
I believe it should be `<textarea disabled></textarea>` or `<textarea disabled="disabled"></textarea>`, likewise for `readonly`.
Salman A
+1  A: 

You Cant do this with CSS, you have to do it in the markup like so:

<textarea disabled="disabled"></textarea>
Dänu
+1  A: 

So you don't want the user to edit the contents of the textarea? Simple solution: Don't use textarea. Just use a normal div or pre and style it.

RoToRa