The user-select property in CSS is used to control the user’s ability to select text. It allows you to define whether text within an element can be selected, preventing or allowing users to highlight and copy content.
Note: The user-select property can take values such as none , auto , text , and all .
/* Disabling text selection within an element */ .unselectable { user-select: none; }
/* Allowing text selection within an element */ .selectable { user-select: text; }
Features:
The user-select properties are as:
none : Prevents text selection within the element.
auto : Allows the browser to determine whether text can be selected (default behavior).
text : Enables text selection within the element.
all : Allows users to select everything, including images and other non-text content.
|