CSS: Cascading Style Sheets
Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS describes how elements should be rendered on screen, on paper, in speech, or on other media.
CSS is among the core languages of the open web and is standardized across Web browsers according to W3C specifications. Previously, the development of various parts of CSS specification was done synchronously, which allowed the versioning of the latest recommendations. You might have heard about CSS1, CSS2.1, or even CSS3. There will never be a CSS3 or a CSS4; rather, everything is now just "CSS" with individual CSS modules having version numbers.
After CSS 2.1, the scope of the specification increased significantly and the progress on different CSS modules started to differ so much, that it became more effective to develop and release recommendations separately per module. Instead of versioning the CSS specification, W3C now periodically takes a snapshot of the latest stable state of the CSS specification and individual modules progress. CSS modules now have version numbers, or levels, such as CSS Color Module Level 5.
Beginner's tutorials
Our learn web development core modules contain modern, up-to-date tutorials covering CSS fundamentals.
- Your first website: Styling the content
-
This article provides a brief tour of what CSS is and how to use it, aimed at people who are completely new to web development.
- CSS styling basics
-
This module provides all the CSS fundamentals you'll need to start learning the technology effectively, including syntax, features, and techniques.
- CSS text styling
-
Here we look at CSS text fundamentals including setting font, boldness, italics, line and letter spacing, and drop shadows. We round off the module by looking at applying custom fonts to your page, and styling lists and links.
- CSS layout
-
This module looks at floats, positioning, other modern layout tools, and building responsive designs that will adapt to different devices, screen sizes, and resolutions.
Reference
The CSS reference is an exhaustive reference for seasoned Web developers, describing every property and concept of CSS, including:
- The syntax and forms of the language
- Specificity, inheritance, and the cascade
- CSS selectors, including pseudo-elements, nesting, scoping and shadow parts
- CSS at-rules, including media and container queries
- CSS values and units module, including numeric data types, textual data types and functional notations
- Box model and margin collapse
- The containing block
- Stacking and block-formatting contexts
- Initial, computed, used, and actual values
- CSS shorthand properties
- CSS flexible box, multi-column and grid layout
- Animation, transitions, and transforms
Cookbook
The CSS layout cookbook aims to bring together recipes for common layout patterns, things you might need to implement in your sites. In addition to providing code you can use as a starting point in your projects, these recipes highlight the different ways layout specifications can be used and the choices you can make as a developer.
Tools for CSS development
- You can use the W3C CSS Validation Service to check if your CSS is valid. This is an invaluable debugging tool.
- Firefox Developer Tools lets you view and edit a page's live CSS via the Inspector and Style Editor tools.
- The Web Developer extension for Firefox lets you track and edit live CSS on watched sites.
Meta bugs
- Firefox: Firefox bug 1323667