XML technologies / CSS / Advanced websites with CSS / Putting CSS in perspective / The benefits of CSS design / Marking up content semantically
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
Separate appearance from content with .css files and remove design-related tags and attributes from HTML, and the remaining code takes an unusual form: it describes only the content’s pure structure and semantic meaning. With CSS controlling all appearance, tags describe structure and meaning rather than visual presentation. Freed of most or all presentation information, HTML can reflect the semantics of the page’s content.
Such clear, minimal HTML has many advantages: it is easier to navigate when making changes or duplicating code for another page. Try viewing the source of a well-built CSS page in your browser. You can understand its semantic HTML within ten seconds. The same page with all design expressed in HTML takes much longer.
Pages with much semantic HTML also perform better in search engines. Fewer design elements mean greater content density. For a requested keyword , the associated keyword density on the page determines its search result ranking.
CSS can significantly increase keyword density in important places on any page. We will see how stylesheets position an HTML element independently of its place in the document. A complex text-entry form with extensive markup can therefore sit at the document’s end, increasing keyword density near the top, while CSS displays the form at the top of the page.
More and more modern browsers support a special attribute on the tag <link> (especially the attribute media) that activates an external stylesheet only for a specific browser or display type. For example, link three .css files to one HTML page: one for desktop browsers, one for printing and one for mobile devices such as a PDA (Personal Digital Assistant) or phone. The same content has three presentations tailored to different media—another benefit of strictly separating CSS from semantic HTML.
Finally, browsers for visually impaired users also benefit from purely semantic markup. The next section explains more.
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg
back to top