Reputation: 34170
How to set the css of a textarea not to be clicked on it.
<textarea></textarea>
Thanks
Upvotes: 3
Views: 7057
Reputation: 6251
If you care to be By-The-Book & standard compliant it is as follows :
For "Unclickable"
<textarea readonly> ... </textarea>
For "Grayed & unclickable" aka Disabled :
<textarea disabled> ... </textarea>
You can find all other properties of "textarea" here.
Upvotes: 0
Reputation: 38420
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.
Upvotes: 2
Reputation: 5929
You Cant do this with CSS, you have to do it in the markup like so:
<textarea disabled="disabled"></textarea>
Upvotes: 1
Reputation: 25229
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.
Upvotes: 13