How to disable text selection
- Previous page Disable text area resizing
- Next page Text selection color
Learn how to disable text selection in HTML using CSS.
This text can be selected.
This text cannot be selected.
disable text selection
You can use user-select
property to disable text selection for elements.
In web browsers, if you double-click on text, it will be selected/highlighted. This property can be used to prevent this situation.
.prevent-select { -webkit-user-select: none; /* Safari */ -ms-user-select: none; /* IE 10 and IE 11 */ user-select: none; /* Standard syntax */ }
Related pages
Reference manual:CSS user-select property
- Previous page Disable text area resizing
- Next page Text selection color