
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
Set whether the text of the element can be selected or not with CSS
Use the CSS user-select property to set whether the text of the element can be selected or not with CSS:
Example
<!DOCTYPE html> <html> <head> <style> div { user-select: none; } </style> </head> <body> <h2>This is demo heading</h2> <div>This is demo text. You won't be able to select it.</div> </body> </html>
- Related Articles
- How to set whether the text of an element can be selected or not with JavaScript?
- Set whether or not an element should be visible while not facing the screen with JavaScript?
- Set whether the column in the table model can be selected or deselected in Java?
- Set whether the row in the table model can be selected or deselected in Java?
- Set whether the cell in the table model can be selected or deselected in Java?
- Set whether the text should be overridden to support multiple languages with CSS
- Determine whether an element should be visible when not facing the screen with CSS
- How to set whether or not an element is resizable by the user with JavaScript?
- Specify whether the flex items should wrap or not with CSS
- Set whether the flexible items should wrap or not with JavaScript?
- Set whether the table border should be collapsed into a single border or not with JavaScript?
- Set the direction of a text with CSS
- Set the text shadow around a text with CSS
- Set whether an animation should be played forwards or using CSS
- How to set whether an element is draggable or not in HTML?

Advertisements