Tuesday, August 2, 2011

CSS





CSS is a Cascading Style Sheet which is used to style a Document.

This helps in styling every html elements using their attributes.

There are three ways of embeding a style sheet into a document

1.External Style sheet
2.Embedded style
3.Inline style

External Style sheet

Here the external style sheet is used to style the document
It is performed using the following tag inside "head" tag of document using "link" tag.

Example


Here rel is the relationship of the external file which is linking to the document and type indicates the type of external file linking to it and the href is the target url of the file.


Embedded Style


Here the style is written in the same document rather linking to other external file.
The style can be written either in the "head" section or "body" section of the document.

It uses the style tag to specify the style which has the closing and opening style tag.

Example



Inline Style

Inline styles are always taken the most precedence over the other two way of styling the document.This is achieved by specifying the style in the same tag of the element of the document.

Example




Which results as follows

Hello from Inline style for document


No comments:

Post a Comment