November 2011
Intermediate to advanced
384 pages
13h 23m
English
You can alter the user-selection highlight — what the user sees when selecting text — using new CSS3 pseudo-elements called ::selection and ::-mozselection. The first syntax is understood by Chrome and Safari and Opera 9.5. The second syntax is supported by Firefox 3.6 and later.
No additional arguments or elements can be specified in the selector, but the CSS declaration is limited to only color-based CSS stylizing. Therefore, background images, borders, font, or text-based stylizing will be ignored:
::selection {
background-color: #f00;
color: #fff;
}
::-moz-selection {
background-color: #f00;
color: #fff;
}
In these example CSS rules, the background is changed to red, and the text color to white. Note ...
Read now
Unlock full access