What is CSS

Cascading Style Sheet (CSS) is a way to control the look and feel of your HTML documents in an organized and efficient manner. Styles define how to display HTML elements with CSS you will be able to:

  1. Add new looks to your old HTML
  2. Completely restyle a web site with only a few changes to your CSS code
  3. Use the “style” you create on any webpage you wish
  4. External Style Sheets can save you a lot of work

Style Sheets Can Save a Lot of Work

Styles sheets define how HTML elements are to be displayed, just like the font tag and the color attribute in HTML 3.2. Styles are normally saved in external .css files and also they can be embedded in html file. External style sheets enable you to change the appearance and layout of all the pages in your Website, by changing one single CSS document. CSS allows developers to control the style and layout of multiple Web pages all at once. As a Web developer you can define a style for each HTML element and apply it to as many Web pages as you want. To make a global change, simply change the style, and all elements in the Website are updated automatically.

Multiple Styles Will Cascade into One

Style sheets allow style information to be specified in many ways. Styles can be specified inside a single HTML element, inside the element of an HTML page, or in an external CSS file. Even multiple external style sheets can be referenced inside a single HTML document.

Cascading Order

What style will be used when there is more than one style specified for an HTML element?
Generally speaking we can say that all the styles will “cascade” into a new “virtual” style sheet by the following rules, where number four has the highest priority:

  1. Browser default
  2. External style sheet
  3. Internal style sheet (inside the tag)
  4. Inline style (inside an HTML element)

So, a style inside an HTML element (inline style) has the highest priority, which means that it will override a style declared inside the tag, in an external style sheet, or in a browser (a default value).