css

What is a cascading Style Sheet?

Let’s split the question in two: What are style sheets? and How do they cascade? I’ll answer the fi rst question now, and although I’ve hinted at the answer above, I’ll talk about the cascade later in the chapter.


A style sheet is simply a text fi le with the fi le name extension .css. A style sheet is a list of CSS rules. Each rule defi nes a particular style that is applied to your XHTML markup; a rule can defi ne the font size of the text of paragraphs, the thickness of a border around an image, the position of a headline, the color of a background, and so on. Many of the sophisticated typography and layout features of print-design programs, such as Adobe InDesign, can now be emulated in Web pages with CSS. Web designers fi nally have comprehensive control of the layout of their pages, without having to resort to workarounds such as tables and spacer GIFs.