×

What Is CSS?

CSS (cascading style sheet) is a language for styling the HTML elements on a page. CSS enables the separation of the HTML document contents from its presentation. If a website has been built with clean HTML the design can be completely changed by just editing the CSS files.

How does it work?

A stylesheets contains a list of rules, each rule consists of a selector and declaration block. A selector selects the HTML element to style, so ‘p’ would select all paragraphs in the page. HTML elements with id’s can be selected with a hash, so ‘#about’ would select the element with the id of ‘about’. Classes can be selected with a full stop prefixing the class name.
Syntax highlighting of CSS rules

More complex selectors can be used to target specific sections too, ‘#about > p’ , selects all paragraphs that are a child of the element with an id of ‘about’.
Versions
CSS3 is the latest version of the CSS specification. It includes features bringing it up to date with modern web design. New properties allow effects such as box and text shadows, rounded corners and background gradients. Previously these effects would’ve been achieved with images, slowing down a website and hindering SEO (text in an image for example, can’t be read by search engines).

Browser support

Browser support for CSS2 on the whole is good, however there are a number of old browsers still widely in use today with a number of quirks. Most notably Internet Explorer 6, a good overview of supported features in multiple browsers can be found at quirksmode.org

CSS3 support has only be added recently to Internet Explorer in version 9. Mozilla Firefox, Google Chrome and Safari have supported some CSS3 features for a number of versions. However some CSS3 features are still in development and better support is being added in each version update.