Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use css to disable text selection in front-end developers

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you the "front-end development how to use css to disable selected text", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "front-end development how to use css to disable selected text" this article.

How to disable selected text

Go directly to the code:

HTML code

/ / html code

Selectable text.

Unselectable text.

Css code

.noselect {

-webkit-touch-callout: none; / * iOS Safari * /

-webkit-user-select: none; / * Chrome/Safari/Opera * /

-khtml-user-select: none; / * Konqueror * /

-moz-user-select: none; / * Firefox * /

-ms-user-select: none; / * Internet Explorer/Edge * /

User-select: none; / * Non-prefixed version, currently

Not supported by any browser * /

}

In IE < 10 and Opera < 15, we need to add an attribute to the element that needs to be disabled.

Unselectable= "on", otherwise it may not work, but modern browsers may not have to be compatible with some older browsers.

The above is all the content of the article "how to use css to disable selected text". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report