Hour12.Formatting Web Pages with CSS Style Sheets


Hour 12. Formatting Web Pages with CSS Style Sheets

In the preceding hour you learned how to use tables to lay out information in rows and columns. Tables have been used heavily across the Web as a page layout tool, but they're now being phased out for that particular purpose thanks to style sheets. Tables are still fine to use but you should focus on using them for their true intent, which is arranging tabular information into rows and columns. In addition to replacing tables as the page layout mechanism of choice, style sheets also are the preferred way to apply fonts, control margins, specify borders, and tweak just about every other visible aspect of web pages.

The concept behind style sheets is simple: You create a single style sheet document that specifies the fonts, colors, backgrounds, and other characteristics that establish a unique look for a web site. You then link every page that should have that look to the style sheet, instead of specifying all those styles repeatedly in each separate document. When you decide to change your official corporate typeface or color scheme, you can modify all your web pages at once just by changing one or two style sheets. So a style sheet is a grouping of formatting instructions that can control the appearance of many HTML pages at once.

Style sheets go far beyond simply separating the content of web pages from how they are formatted. CSS style sheets enable you to set a great number of formatting characteristics that were never possible before with any amount of effort. These include exacting typeface controls, letter and line spacing, margins and page borders, and expanded support for non-European languages and characters. They also enable sizes and other measurements to be specified in familiar units such as inches, millimeters, points, and picas. You can also use style sheets to precisely position graphics and text anywhere on a web page.

In short, style sheets bring the sophistication level of paper-oriented publishing to the Web. And they do soyou'll pardon the expressionwith style.

By the Way

If you have three or more web pages that share (or should share) similar formatting and fonts, you may want to create a style sheet for them as you read this hour. Even if you choose not to create a complete style sheet, you'll find it helpful to apply styles to individual HTML elements directly within a web page.





SAMS Teach Yourself HTML and CSS in 24 Hours
Sams Teach Yourself HTML and CSS in 24 Hours (7th Edition)
ISBN: 0672328410
EAN: 2147483647
Year: 2005
Pages: 345

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net