CSS user-select
- Planted:
I came across user-select
in the vscode codebase. You can set user-select: none
, for example, to prevent text selection.
In most cases, its value is text
. The exceptions are ::before
and ::after
pseudo-elements and any element whose parent with user-select: <none|all>
.
Setting user-select: all
on an element means that selecting any of its descendents will select all text in that element and its descendents. I’m not sure when I’d use that, though, because it prevents more granular selection of text.