Learning Story
Sign In
Join Learning Story
Feed
Leaderboard
FAQ
Support
Daniel Schwarz
3 months ago
Front-end development
I learned CSS user-select: (stop users copying text!)
Discuss (5)
Tweet
Daniel Schwarz
3 months ago
Beware of a11y concerns :)
Dmitrii Pashutskii
3 months ago
Oh, that's cool! I didn't know about this selector.
Daniel Schwarz
3 months ago
Property 😁 Example: article.log-in-to-read-this { user-select: none; // user cannot select (copy) the article } Full code: article { opacity: 0.5; // opaque filter: blur(0.5rem); // blurry user-select: none; // remove selection pointer-events: none; // remove all events } Also: document.querySelector("article").setAttribute("tabindex", "-1"); // user cannot focus on the links inside the article
Daniel Schwarz
3 months ago
My line breaks 😭
Dmitrii Pashutskii
3 months ago
Yeah, I need to improve comments! Working on it!
Send feedback
Help us to build better product
Send feedback
Send us feedback
Your email (optional)
Any suggestions, feature requests, bug reports.
Cancel