28-02-2013, 12:35 PM
Cascading Style Sheets (CSS)
Cascading Style.ppt (Size: 286.5 KB / Downloads: 38)
Benefits of Cascading Style Sheets
Separate document presentation from document content
More features for formatting the appearance
Can define font, size, background color, background image, margins, etc.
Share style sheets across multiple documents or entire Web site
Reduce development and maintenance time
Can specify a class definition for a style, effectively defining new HTML elements
Flexible – rules are applied in a hierarchical manner (precedence rules)
Cascading Style Sheets
A simple text file with “.css suffix”
CSS, Level 1 (1996)
Concerned with applying simple styles to HTML elements
CSS, Level 2 (1998)
Incorporates and extends CSS-1
Supports media-specific style sheets (visual browsers, aural devices, printers, etc)
CSS, Level 3 (Under development)
Incorporates and extends CSS-2
Focused on modularization of the CSS specification
New selectors, fancy borders and backgrounds, vertical text, user interaction, speech and much more.
CSS Syntax
Statement must have one or more selectors and a declaration.
Selector specifies which HTML elements to be affected.
Declaration is one or more properties separated by semicolons “;”.
Property has name and value separated by a colon “:”.
Some values have unit
White space is ignored but can improve readability
Three Ways of Using CSS
External Style Sheet
Store CSS code in an external file (usually with .css extension)
Apply to any document that explicitly includes the .css file
Internal or Embedded Style Sheet
Defined in HTML document
Affect only the page where the style is defined
Inline Styles
Specified as an attribute in HTML tag
Apply to only one element
Cascading Style.ppt (Size: 286.5 KB / Downloads: 38)
Benefits of Cascading Style Sheets
Separate document presentation from document content
More features for formatting the appearance
Can define font, size, background color, background image, margins, etc.
Share style sheets across multiple documents or entire Web site
Reduce development and maintenance time
Can specify a class definition for a style, effectively defining new HTML elements
Flexible – rules are applied in a hierarchical manner (precedence rules)
Cascading Style Sheets
A simple text file with “.css suffix”
CSS, Level 1 (1996)
Concerned with applying simple styles to HTML elements
CSS, Level 2 (1998)
Incorporates and extends CSS-1
Supports media-specific style sheets (visual browsers, aural devices, printers, etc)
CSS, Level 3 (Under development)
Incorporates and extends CSS-2
Focused on modularization of the CSS specification
New selectors, fancy borders and backgrounds, vertical text, user interaction, speech and much more.
CSS Syntax
Statement must have one or more selectors and a declaration.
Selector specifies which HTML elements to be affected.
Declaration is one or more properties separated by semicolons “;”.
Property has name and value separated by a colon “:”.
Some values have unit
White space is ignored but can improve readability
Three Ways of Using CSS
External Style Sheet
Store CSS code in an external file (usually with .css extension)
Apply to any document that explicitly includes the .css file
Internal or Embedded Style Sheet
Defined in HTML document
Affect only the page where the style is defined
Inline Styles
Specified as an attribute in HTML tag
Apply to only one element