13.02.2013 Views

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

WEB STANDARDS CREATIVITY

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

96<br />

Each of the paragraphs of introductory text will be styled with a different-colored background image and a larger type size,<br />

as shown in Figure 4-6. Once again, the first rule is common to all three paragraphs.<br />

div[id="worriers"] h2 + p,<br />

div[id="worries"] h2 + p,<br />

div[id="worrydone"] h2 + p {<br />

min-height : 4em;<br />

margin : 0;<br />

padding : 5px 20px 40px 20px;<br />

font-size : 120%;<br />

line-height : 1;<br />

color : #fff; }<br />

div[id="worriers"] h2 + p {<br />

background : #cc6195 url(../images/worryone-m.png) no-repeat 0 100%; }<br />

div[id="worries"] h2 + p {<br />

background : #dd82ae url(../images/worrytwo-m.png) no-repeat 0 100%; }<br />

div[id="worrydone"] h2 + p {<br />

background : #f0a4c7 url(../images/worrythree-m.png) no-repeat 0➥<br />

100%; }<br />

Figure 4-6. Distinctly different syling for the three introductory paragraphs<br />

Wait, what is that + symbol doing in these selectors? This symbol is known as a sibling combinator and forms<br />

an adjacent sibling selector. This type of selector selects one element based on the element that precedes it;<br />

in this case, a p element that immediately follows an h2. Web designers and developers have largely avoided<br />

this type of selector because of a lack of support for it in Internet Explorer prior to version 7.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!