CSS user-select Property Explained
What the CSS user-select property does, with an example.
Published November 6, 2026
user-select controls whether text can be selected: auto, none, text or all. Use none for UI chrome and all for copy-friendly code snippets.
How it works
Disabling selection on buttons and drag handles avoids accidental highlighting. Do not disable it on content people may want to copy.
Safari historically required the -webkit- prefix.
Values and effects
user-select: none; → cannot select
user-select: text; → selectable
user-select: all; → select all on click
user-select: auto; → default
Practical examples
Button labels
button { user-select: none; }Copy-friendly token
.token { user-select: all; }Draggable
.drag-handle { user-select: none; cursor: grab; }Common mistakes
- Disabling selection on whole pages (hurts accessibility).
- Believing it protects content from copying.
- Forgetting the prefix for older Safari.
Key takeaways
- user-select in one line: user-select controls whether text can be selected: auto, none, text or all.
- Inspect it live in DevTools → Styles.
- Test across browsers and screen sizes.
FAQ
Does none prevent copying?
Not really; it only affects UI selection.
Is user-select supported in all browsers?
Yes in all modern browsers; check caniuse.com for edge cases.