开发者

Textarea css not clickable

How to set the css of a textare开发者_运维百科a not to be clicked on it.

           <textarea></textarea>

Thanks


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.


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.


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

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


If you care to be By-The-Book & standard compliant it is as follows :

  1. For "Unclickable"

    <textarea readonly> ... </textarea>

  2. For "Grayed & unclickable" aka Disabled :

    <textarea disabled> ... </textarea>

You can find all other properties of "textarea" here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜