XML Programming  «Prev 

Separating format from Structure

The WYSIWYG wave made Tim Berners-Lee's vision of well-structured documents readable with a universal client more remote.
In an effort to regain the original vision, a proposal was made and accepted by the World Wide Web Consortium (W3C) for separating formatting elements from HTML. The first version of this effort came to fruition in the Cascading Style Sheets, Level 1 Recommendation(CSS1). CSS2 is now the recommendation that supercedes and extends CSS1.
CSS states that all formatting should be defined either in a separate document called a style sheet, in a STYLE section within an HTML page, or as values for a STYLE attribute within tags. In other words, the use of tags such as <CENTER> and <FONT> are now discouraged by the W3C, and these elements are said to be "deprecated" in favor of style sheets. Authors are strongly discouraged from using deprecated elements when creating code for their Web pages.

Example - HTML with CSS

An HTML document uses the structural features of HTML, such as paragraphs, lists, headings, and other HTML elements. HTML avoids presentational features such as font changes, layout hints, etc. CSS is used to format the document based on its structural properties. "Class" attributes that are designed well in the HTML extend the semantics of the structural markup if needed to allow more flexible formatting with CSS. Assistive technologies can substitute or extend the CSS to modify presentation, or ignore the CSS and interact directly with the structural encoding.