0

::selection

How th browser knows what text to select?

10th Feb 2017, 10:57 PM
Pedro Adrião
Pedro Adrião - avatar
1 Réponse
+ 2
The user select text, and the browser use this pseudo selector to determine what custom style you want to be applyed on the 'selected text' ( obviously by the user )... ::selection { background:red; } ... will make user selected text with a red background ( guessing you've not already choice a such color for that in your os desktop ) for anything in the page: seems to not be possible to target more specifically ^^ To be working on Firefox, need to be vendor prefixed: ::-moz-selection, ::selection { /* ... */ }
11th Feb 2017, 3:51 AM
visph
visph - avatar