CSS User Select
The user-select property in CSS controls whether the user can select text. This does not affect content loaded as part of the user interface (like text in form fields), but it does control standard text content.
Why use it?
You typically disable selection on interactive UI elements (tabs, buttons, menus, icons) where double-clicking might trigger an action but accidentally highlighting the text looks broken. You enable specific selection types (like all) to make copying API keys or code snippets easier.
Key Values
- auto: The default. The browser decides whether to allow selection.
- none: Prevents selection entirely. Good for UI components.
- text: The text can be selected by the user. Useful to override
nonefrom a parent. - all: The content is selected as a single unit. A single click selects the entire block.
