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

AI Liability: Who Is Responsible When AI Gets It Wrong?
I'm a software engineer, not a lawyer. But I've been watching the AI liability conversation closely, and the gap between how AI systems actually work and how our legal system assigns blame is becoming a real operational problem for anyone deploying AI.
17 July 2026

Building Minesweeper in React, Part 1: Client-Side Architecture
Part 1: building a fully playable Minesweeper in React. Board generation, safe first click, flood fill, and Web Audio effects. Then examining what "client-side only" actually means for trust, cheating, and what breaks the moment you want a scoreboard.
16 July 2026

MCP Explained: How AI Models Talk to Your Tools (and What Comes Next)
MCP is the protocol that lets Claude, ChatGPT, and Gemini all talk to your GitHub repo, your database, and your calendar without three different integrations. It's not a ratified standard yet, it's a fast-moving spec under a young foundation, and it's about to change shape again.
15 July 2026

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
