DHTML Tutorials

CSS in DHTML
Previous Home Next

Cascading Style Sheet  defines a particular formatting style. A style may have to do with the way text is displayed (font style, font type, color, etc.) or with the way page elements are laid out (margins, borders, etc.) -- or both at one time for that matter. When we define a style sheet, we are defining the style with which text will be displayed. Applying the style sheet is a convenient way to enforce a consistency of appearance across a document or across a whole Web site.

A further advantage is that if we decide later to change some of these appearance characteristics, we can simply change the style sheet and all page elements that use that style sheet will be automatically updated. A final advantage to style sheets is that they give us access to formatting that can not be done using HTML tags alone, so in these cases they do actually extend the capabilities of HTML.

For example, Suppose we wish for all the H2 headings in a document to appear in red text and be italicized.We can accomplish this as follows:

CSS code

  <H2><FONT Color= red>All About CSS</FONT></H2>

OUTPUT

Previous Home Next