CSS Tutorial
CSS stands for Cascading Style Sheets. A style sheet is made up of style rules that tell a browser how to display HTML elements. HTML documents can be displayed by using different output styles, by the use of CSS. Styles are normally saved in External Style Sheets.
Why External Style Sheets??
By making a change in a single External Style Sheet, you can change the layout of all the web pages.
A style can be mentioned in an HTML element,
, or it can be mentioned inside an external CSS file. Multiple External CSS can also be referenced in a single HTML document. Suppose, there are more than one style mentioned for an HTML element. What happens is that all the styles "cascade" into a new "virtual" style sheet. The priority order is as follows:1) Inline style (inside an HTML element)
2) Internal style sheet (inside the tag)
3) External style sheet
4) Browser default
This order is popularly known as cascading order.
Let's try to understand with the help of an example the use and importance of CSS.
Suppose, a document contains text in bold at many places like given below:
This is one text in bold.Now, suppose you want all the text that is in bold to be underlined as well as have color blue. This would require editing the entire document like:
This is one text in bold.Editing the text in the entire document would be quite cumbersome. A short-cut would be CSS. This would need editing at only one place.
