CSS Master

(Primo) #1

Figure 1.22. Adding display: block to content added with ::before means that styles defined for p::first-line
will affect that content


Unfortunately,thisisyettoworkinFirefoxversion 40 orearlier.Firefoxignores
therulesetcompletely.


User Interface Fun with ::selection


The::selectionpseudo-elementisoneoftheso-called“highlightpseudo-elements”
definedbyCSSPseudo-ElementsModuleLevel4.^12 FormerlypartoftheSelectors
Level 3 specification,it’stheonlyhighlightpseudo-elementimplementedby
browsers.^13


With::selection,wecanapplyCSSstylestocontentthatusershavehighlighted
withtheirmouse.Bydefault,thebackgroundandtextcolorofhighlightedcontent
isdeterminedbysystemsettings;however,developerscanchangewhatthathighlight
lookslike,asindicatedinFigure1.23.


(^12) http://dev.w3.org/csswg/css-pseudo-4/
(^13) InFirefox,thispseudo-elementrequiresa-moz-prefix,likeso::-moz-selection.
Selectors 35

Free download pdf