Tuesday, January 20, 2009

Style sheet

A CSS style sheet consists of two parts
1 selector which can be a HTML tag such as p1 or h1,
and declaration which defines the property the value of the selector.

h1 {color: blue}
p {font-family: Arial,; color: black}

way of using CSS
1. External style sheet
2. Embedded style sheet
3. Inline style sheet

For example in embedded style sheet, style sheet code is embedded in html code using #style# tag.
#style type="text/css"#
#!--
h1 {color: blue}
p {font-family: Arial,; color: black}
--#
#/style#

External style sheet:
Keeps the style rules in a separate file, apart from the HTML web document. advantage of using an external style sheet is that you can apply same style rules to more than one document in your web site.
this helps in creating web pages with consistent appearance and modification of style sheet will be consistently reflected on all the related web pages.
style sheet => an ASCII text document with a special extension (.css).
use of #link# tag to connect to web page(html file).

#head#
#title#xxxxx#/title#
#link rel="stylesheet" href="mystyle.css"#
#/head#

No comments:

Post a Comment