15.04.2018 Views

programming-for-dummies

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

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

Cascading Stylesheets 483<br />

If you have two external stylesheets that <strong>for</strong>mat the same text, define the<br />

order to apply the external stylesheets by using multiple tags like<br />

this:<br />

Book V<br />

Chapter 2<br />

<br />

<br />

<br />

<br />

<br />

<br />

CSS<br />

In the preceding example, the styles stored in the file2.css stylesheet<br />

take precedence over the styles stored in the file1.css. Any styles stored<br />

in the HTML code of your Web page takes precedence over any styles stored<br />

in either the file2.css or file1.css external files.<br />

The general rule is that text will be <strong>for</strong>matted according to the stylesheet<br />

closest to the text. So an internal stylesheet is closer to text than an external<br />

stylesheet, which is why styles stored in an internal stylesheet take precedence<br />

over an external stylesheet.<br />

If you want to create a Web page with a unified appearance, you might define<br />

the <strong>for</strong>matting <strong>for</strong> every tag inside a single external stylesheet. Then modify<br />

one or two styles (stored in additional external stylesheets or embedded in<br />

the HTML code of a specific Web page) in case you want to <strong>for</strong>mat some text<br />

differently.

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

Saved successfully!

Ooh no, something went wrong!