开发者

How to make certain text not selectable with CSS [duplicate]

This question already has answe开发者_如何转开发rs here: How to disable text selection highlighting (45 answers) Closed 9 years ago.

The community reviewed whether to reopen this question 1 year ago and left it closed:

Original close reason(s) were not resolved

The header for my page has some centered text, but I do not want the user to be able to select it. Is there a way to do this with CSS?


The CSS below stops users from being able to select text.

-webkit-user-select: none; /* Safari */        
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */

To target IE9 downwards the html attribute unselectable must be used instead:

<p unselectable="on">Test Text</p>


Use a simple background image for the textarea suffice.

Or

<div onselectstart="return false">your text</div>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜