MoreLesson 256Free preview
Disable Text Selection
This lesson is part of How To · All levels
Summary
The user-select property determines whether text can be selected by the user. The none value is useful for buttons, navigation labels, or interface elements so that clicks will accidentally highlight text. But don't think of it as content protection, because the text is still readable from the source code and shouldn't be applied to the entire page.
Key points
- User-select: none prevents text selection on the element.
- Other values include auto, text, and all; text allows for customary selection.
- Apply only to the interface components, not the entire body or article.
- User-select is not a content security; users can still see HTML and CSS.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.