How to disable text selection with CSS
Published
12 Dec 2022
The CSS user-select property, originally proposed and then abandoned in CSS 3 and now proposed in CSS UI Level 4, controls how an element's text is allowed to be selected and can be used to make text unselectable.
Unselectable
.noselect { -webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Safari */ -khtml-user-select: none; /* Konqueror HTML */ -moz-user-select: none; /* Old versions of Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */ user-select: none; /* Chrome, Edge, Opera and Firefox */}This still doesn't cover all possibilities. While it is impossible to initiate selections in unselectable elements, in some browsers (Internet Explorer and Firefox, for example) it's still impossible to prevent selections that start before and end after the unselectable element without making the whole document unselectable.
Select All
You can also use this to enforce that an entire element gets selection.
.selectAll { -webkit-user-select: all; /* Chrome 49+ */ -moz-user-select: all; /* Firefox 43+ */ -ms-user-select: all; /* No support yet */ user-select: all; /* Likely future */ }Similar articles

Sorting Algorithms Explained
Bubble, selection, insertion, merge, quick, and heap sort: how each one works, where it shines, where it struggles, and animated demos that run the real algorithm code on the same starting data every time.
13 July 2026

Set Membership Testing: From Arrays to Bloom Filters
Every time Chrome warns you a site might be malicious, it just answered a membership question: is this URL in a set of bad ones? Here's how that check works, from a plain array to the probabilistic Bloom filter that makes it possible at scale.
10 July 2026

Why You Shouldn't Use Floating Point Math for Money in JavaScript
JavaScript numbers look like ordinary decimals, but they are stored as binary floating point. That is why 0.1 + 0.2 is not 0.3, and why checkout totals, tax lines, and ledger comparisons can quietly go wrong.
4 July 2026

RFC 10008: HTTP Finally Gets a Query Method
For thirty years, complex searches have been squeezed into GET query strings or smuggled through POST. RFC 10008 standardises QUERY: a safe, idempotent HTTP method with a request body. Here is why that matters and when you can actually use it.
3 July 2026