Selecting a long command by dragging always seems to miss the first or last character. With user-select: all a single click selects the whole element.
.copy-me {
-webkit-user-select: all;
user-select: all;
}
I’d put it on short things people copy: an install command, an API key placeholder, a hash. Click once and the full text is selected, so Ctrl+C or Cmd+C gets everything. MDN also notes that a double click inside the element keeps the selection on the whole element instead of a single word.
The same property can do the opposite. user-select: none keeps text like button labels or the line numbers in a code listing from being selected, so a copy of the code does not include them.
The prefixed line still matters. Safari supports the value only through -webkit-user-select in current stable versions; MDN lists the unprefixed property for a Safari beta only. So keep both lines.
Use all on small elements only. On a long paragraph it gets annoying fast, because people can no longer select a single sentence to quote.
Further reading: MDN: user-select