Whenever we select some text, the entire text area gets highligted. like this .
but is there any way to do away with this highlighting? I want just the color of the text to change and not the area to be highlighted as it appears in the image? am I clear enough?
Depends on which browsers you need to support. Not sure if Internet Explorer does support it, but here are the three CSS pseudo-elements you can try:
::selection (works in my Chrome)
::-moz-selection
::-webkit-selection
For example:
p::selection {
background:#cc0000;
color:#fff;
}
Also see http://www.quirksmode.org/css/selection.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With