What is CSS?
- CSS stands for Cascading Style Sheets
- Styles define how to display HTML elements
- Styles were added to HTML 4.0 to solve a problem of presentation
- External Style Sheets can save a lot of work
- External style sheets are stored in CSS files
HTML is the language we use to structure our pages. CSS, or Cascading Style Sheets, is simply a way to add styling to your web site. It adds the presentational layer. Let me reiterate that:
HTML = structure
CSS = presentation
CSS is made up of a set of rules you create to tell browsers how to display your site. Each rule selects a particular element (or set of elements) and declares how it should be displayed by the browser. It is its own language with its own syntax.
Check out the power of CSS: CSS Zen Garden
When you click through the list of styles, you can see how radically different the styles are. The content is identical throughout, and all you are doing is switching form one style sheet to the next. Pretty darn neat!
Here are many examples of styling from the W3
Why use CSS?
- Better type and layout control: all of your styling is in one document. You change the one document, and your ENTIRE site is updated.
- Less work: in the old days, we added styles to each element, so when we had an update, we had to go through every single page.
- Smaller documents, meaning faster downloads for your viewers
- More accessible sites: your site can be read by nonvisual or mobile devices
- Better browser support
We are concentrating on external style sheets, meaning all of the rules for our sites will be contained on a document of their own. That means we will create a style sheet for all of our CSS rules, attach it to our html document and then the browser will use our CSS to display the HTML page.