[CSS] Select text with one click

Answer1215 / 2023-07-20 / 原文

This trick is inclined towards improving copy and paste experience for website users. Using user-select: all, you can enable easy text selection with one click. All text node below that element is selected.

On the other hand, you can disable text selection with user-select: none;. Alternative way to disable text selection is placing text inside content: ''; property of ::before or ::after CSS pseudo element.

 

Read More: https://dev.to/smitterhane/13-css-tricks-that-will-give-you-an-adrenaline-rush-5908