CSS Master

(Primo) #1
Figure 1.5. Adjacent combinator to the rescue

Let’slookatanotherexamplethatcombinestheuniversalselector(*)withatype
selector:


01-selectors/adjacent-sibling-combinator.html (excerpt)
* + fieldset {
margin: 5em 0;
}

Thisexampleaddsa5emmargintothetopandbottomofeveryfieldsetelement,
showninFigure1.6.Sincewe’reusingtheuniversalselector,there’snoneedto
worryaboutwhetherthepreviouselementisanotherfieldsetorpelement.


Selectors 9

Free download pdf