Difference between revisions of "CSS"

From Million Dollar Wiki
Jump to: navigation, search
(External Stylesheets)
Line 16: Line 16:
  
  
== External Stylesheets ==
+
=== External Stylesheets ===

Revision as of 16:30, 1 November 2007


What is CSS?

CSS is often seen as a complex web language that can end up baffling some users and can appear slightly intimidating. However, when explained in simple terms, it isn’t really that complex. In a nutshell, CSS is merely a HTML shortcut for users to avoid repetitious coding and use of the same tags over and over again. Cascading Style Sheets can be defined as a set of instructions for existing content, either in an external file or embedded in the page coding, used to bring style and structure (such as colours, images, fonts and layout) to a website. Not only does CSS enable the user to add style and structure but it also enables it to be done in bulk – that is, to entire pages simultaneously with one single reference. With CSS, a website can be formatted without the need for extensive coding.

Regarded as a powerful tool, CSS is also viewed as a huge time saver. If you wanted to change the font to Verdana for example, you would need to go through all 50 pages to switch over to the new font. Applying CSS in the proper manner (using an external style sheet) would mean that the change would only need to be made in one file, and the site would then update globally with the changes. Also, CSS makes your pages significantly much lighter and faster to download (as much as 50%), as there’s no need to repeat the same instructions throughout the coding.

CSS files are known as “cascading” stylesheets because styles inherit the properties of other previously defined styles, so properties "cascade down" the file as entered.

There are essentially three types of CSS:

  • Inline Style - applied to the individual HTML tag in a page.
  • Embedded or Internal Style Sheets - for controlling the display of an individual page by adding instructions between the <head> and </head> tags.
  • Linked External Style Sheets – used to control an entire site from one file.


External Stylesheets