This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

What is CSS?

Summary

The article introduces you to Cascading Style Sheets (CSS), defining what they are, and what they are used for on the Web.

About CSS

Cascading Style Sheets (CSS) is a language for specifying how documents are presented to users. A document is a collection of information that is structured using a markup language such as HTML (HyperText Markup Language). CSS is a foundation technology, used today by most documents on the web.

The primary goal of CSS is to allow separation of a document’s presentation characteristics (formatting) from the document’s content. Separating content and formatting simplifies document creation and maintenance, improves presentation flexibility, and allows multiple HTML pages to share formatting by placing formatting rules in an external file.

CSS rules can control virtually every aspect of data formatting, including font, color, weight, spacing, positioning, background colors and images, link characteristics, and more.

Web documents

A web page like the one you are reading is a document. The information that you see in a web page is usually structured using HTML, and the actual content of the page and its presentation characteristics may come from a variety of sources.

When your web browser requests the page, one of the sources is typically a CSS file containing formatting directives, or rules. The web page explicitly references the CSS file, in effect requesting that the CSS rules be applied to the page contents.

Document presentation

Presenting an HTML document to a user means converting it into a form that humans can read and use. Browsers such as Chrome, Opera, Firefox, and Internet Explorer are designed to present documents visually, and make use of CSS rules to determine how to format the data contained in the HTML document to achieve that presentation.

Conclusion

Thus, a web page you see in a browser is a combination of the document’s data sources, with the CSS formatting rules applied. In the other tutorials in this section you will learn more about CSS, why it is important, and how to use it effectively.

See also

Contributions

Attributions

  • Microsoft Developer Network.