Prev | Current Page 269 | Next

Charles Wyke-Smith

"Stylin' with CSS: A Designer's Guide 2nd Edition"

We might add this code into the head of
our document:

STYLIN??™ WITH CSS - CHAPTER 7 240
which is the equivalent of

Both of these methods associate the style sheet with the page.
@import is useful because, being CSS, it can be used in a style sheet.
In other words, you can link your page to one style sheet that contains
a list of @import rules, each of which loads a style sheet.
So, rather than dumping the hundreds of lines of styles needed for
a typical site into a single style sheet, I can organize my CSS into a
number of separate style sheets and load them using a single link
tag in the XHTML page. Typically, I use one style sheet for the layout,
one for text, and others for large components such as the forms
and menus that might appear in some pages but not others. As you
will see, this allows me to load only the style sheets that any given
page actually needs.
To do this, I add a listing of a set of style sheets to an ???import??? (my
term) style sheet, and then associate just this import style sheet with
all the pages that need those style sheets. This import style sheet,
which lives in the CSS folder along with all the other style sheets,
effectively acts as a pointer to a set of style sheets.


Pages:
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281