Style sheets exist, above all, to enable the following principle to be put into practice.
As a developer this means that the information in your web site should go into your HTML files, but HTML files should not contain information about how that information is displayed. And you've probably guessed by now that information about how the pages should appear goes into CSS files.
The traditional HTML approach was to "hardcode" all of the appearance information about a page. So you want all your headings in courier, and at different point sizes to the sizes built into browsers? Then, for every heading, in every page, set the font size and face properties. You've got more than 100 pages? That is a lot of editing, and a lot of re-editing if you decide to modify the appearance of your pages later. And with all of that editing there is plenty of possibility for introducing errors.
With CSS, you can decide how headings should appear, and enter that information once. Every heading in every page that is linked to this style sheet now has that appearance. Want to make every heading of level 3 more obviously different from those of level 2? Edit the style sheet, and every such heading now has the altered appearance. How many hours' work (and potential errors) have you just saved?
Another major advantage involves the management of large, sophisticated sites. With cascading style sheets, whole organizations can share a small number of style sheets, ensuring consistency across the site with no need for constant updating and editing to accommodate changes. For a discussion of this advantage in detail, see Managing Style at Large Sites, in the section on cascade and inheritance.
As a developer this means that the information in your web site should go into your HTML files, but HTML files should not contain information about how that information is displayed. And you've probably guessed by now that information about how the pages should appear goes into CSS files.
The traditional HTML approach was to "hardcode" all of the appearance information about a page. So you want all your headings in courier, and at different point sizes to the sizes built into browsers? Then, for every heading, in every page, set the font size and face properties. You've got more than 100 pages? That is a lot of editing, and a lot of re-editing if you decide to modify the appearance of your pages later. And with all of that editing there is plenty of possibility for introducing errors.
With CSS, you can decide how headings should appear, and enter that information once. Every heading in every page that is linked to this style sheet now has that appearance. Want to make every heading of level 3 more obviously different from those of level 2? Edit the style sheet, and every such heading now has the altered appearance. How many hours' work (and potential errors) have you just saved?
Another major advantage involves the management of large, sophisticated sites. With cascading style sheets, whole organizations can share a small number of style sheets, ensuring consistency across the site with no need for constant updating and editing to accommodate changes. For a discussion of this advantage in detail, see Managing Style at Large Sites, in the section on cascade and inheritance.
No comments:
Post a Comment