04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

what the cascade does<br />

474 Chapter 11<br />

So, to review, as the page<br />

authors, we can use multiple<br />

style sheets <strong>with</strong> our X<strong>HTML</strong>. And, the<br />

user might also supply their own styles,<br />

and then the browser has its default styles,<br />

too. And on top of all that we might have<br />

multiple selectors that apply to the same<br />

element. How do we figure out which<br />

styles an element gets?<br />

That’s actually another way of asking what<br />

cascade does. The cascade is the way the<br />

browser decides, given a bunch of styles<br />

in a bunch of style sheets, which style is<br />

going to be used. To answer that question<br />

we need to bring everything together – all<br />

the various style sheets hanging around,<br />

the rules, and the individual property<br />

declarations in those rules.<br />

In the next two pages we’re going to step<br />

through the nitty gritty details of how all<br />

this works. The details involve a lot of<br />

sorting and various details of determining<br />

which rules are the most specific <strong>with</strong><br />

respect to an element. But here’s the payoff:<br />

after going through the next two pages,<br />

you’ll be able to get to the bottom of any<br />

styles that don’t seem to be applied in the<br />

way you expect, and further, you’re going<br />

to understand more about the cascade than<br />

99% of Web page developers out there<br />

(we’re not kidding).

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

Saved successfully!

Ooh no, something went wrong!