Prev | Current Page 462 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

css will be linked to, but if
the user has a different operating system, it won??™t. (Win and Linux are values for other
popular operating systems that you may wish to target.)
To target specific browsers, use the following code block, replacing BrowserName with
Firefox, IE (for Internet Explorer, although conditional comments are a better bet for
dealing with IE issues), Mozilla, Netscape, OmniWeb, Opera, or Safari. Obviously, you also
need to change the file name of the CSS document in the href line, too, from
hacks-file.css to the relevant CSS document for your chosen browser in the first line of
the script.
if (navigator.userAgent.indexOf('BrowserName')!= -1) {
var cssNode = document.createElement('link');
cssNode.setAttribute('rel', 'stylesheet');
cssNode.setAttribute('type', 'text/css');
cssNode.setAttribute('href', 'hacks-file.css');
document.getElementsByTagName('head')[0].appendChild(cssNode);
}
THE ESSENTIAL GUIDE TO CSS AND HTML WEB DESIGN
368

10 PUTTING EVERYTHING TOGETHER
In this chapter:
Combining methods to create website designs
Creating a blog layout
Creating a storefront layout
Creating a homepage layout
Creating an online gallery
Working with style sheets for print output
Putting the pieces together
The majority of this book intentionally works in a modular manner. The idea is that you
can work on the various components as you wish and then combine them to form all manner
of websites.


Pages:
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474