CSS: Cascading Style Sheets
Cascading Style Sheets (CSS) is astylesheet language used to describe the presentation of a document written inHTML orXML (including XML dialects such asSVG,MathML orXHTML). CSS describes how elements should be rendered on screen, on paper, in speech, or on other media.
CSS is among the core languages of theopen web and is standardized across web browsers according toW3C 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 todevelop and release recommendations separately per module. Instead of versioning the CSS specification, W3C now periodically takes a snapshot ofthe latest stable state of the CSS specification and individual modules progress. CSS modules now have version numbers, or levels, such asCSS Color Module Level 5.
In this article
Beginner's tutorials
Ourlearn 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.
Guides
CSS guides are organized by modules and are there to help you learn what you can achieve using CSS. Browse the complete list atCSS guides, which includes topics such as:
- CSS syntax including declarations and rulesets.
- Specificity,inheritance, andcascade
- Nesting,scoping andshadow parts
- Media andcontainer queries
- Numeric andtextual data types
- Box model andmargin collapse
- Containing block
- Stacking andblock-formatting contexts
- Property value processing
- Shorthand properties
- Flexible box,multi-column andgrid layouts
- Animations,transitions, andtransforms
How to
- CSS layout cookbook
Recipes for common layout patterns you might need to implement in your sites. These recipes provide code you can use as a starting point in your projects. These recipes also highlight the different ways layout specifications can be used and the choices you can make as a developer.
Tools
- Border-image generator
Generate CSS
border-imagevalues.- Border-radius generator
Generate CSS
border-radiuseffects.- Box-shadow generator
Add
box-shadoweffects to your CSS objects.- Color format converter
Enter or pick a color and copy its corresponding value in any CSScolor format.
- Color mixer
Mix two colors in any color space using the
color-mix()function and copy the resulting color in any CSS color format.- Shape generator
Define coordinates and syntax for
<basic-shape>features.
You can also use the following resources:
- W3C CSS Validation Service: To check if your CSS is valid. This is an invaluable debugging tool.
- Firefox Developer Tools: To view and edit a page's live CSS via theInspector and theStyle Editor tools.
- Web Developer extension: To track and edit live CSS on websites in Firefox.
Reference
Browse the completeCSS reference documentation.
- CSS properties
Reference for all CSS properties.
- CSS selectors
Reference for CSS selectors,combinators,pseudo-classes, andpseudo-elements.
- CSS at-rules
Reference for CSS at-rules including media queries.
- CSS values
Reference for CSS keywords,data types, andfunctions.