"The latest news about Web development, techniques, and trends"
CS 112 students learn about CSS
Simple syntax, powerful design tool
Style sheets are used to define a document's appearance by prescribing various elements such as the size, color and fonts of the character set,  the margins, spacing, width and height and other components of  layout.  Typically, style sheets are defined or invoked at the beginning of a document, and they are applied to the entire document.  As necessary, specific elements of the overall style sheet can be overridden by special coding that applies to a given section of the document.

A cascading style sheet (or CSS) is a Web page derived from multiple sources.  Those sources "cascade" throughout the document, defining an order of precedence where those definitions of styles could conflict.  The current CSS specification (CSS2.1 or Cascading Style Sheet, level 2.1) from the World Wide Web Consortium (W3C) describes the standards Web page designers should use.  CSS specifications can be found at   http://www.w3.org/Style/CSS/

     CSS gives a lot of control to the page designer and with a CSS the style definition can come from different sources.  In case of conflict, here is the order of precedence:
  1. Individual Tag marked with a STYLE attribute
  2. Link or inclusion of a distinct file containing STYLE elements. In a Web page, STYLE elements are placed between the <title> statement and the <body> mark.
  3. Imported style sheet (using the CSS @import command) which brings in and merges an external style sheet with the current style sheet
  4. Style attributes specified by the viewer to the browser
  5. A default style sheet available through the browser

For a brief overview of the CSS Syntax, look at the CSS Syntax page and you should also look at an explanation of the concepts of ID and Class Attributes from the Attribute page

 

Syntax and examples