Skip to content
Foxipa

Suggest an edit

Tell us what should be corrected, clarified, or improved. Submission will be connected to Foxipa’s contribution service later.

No information is sent anywhere yet. Your suggestion is only prepared in your browser.

Learning

CSS Foundations

Understand CSS as a stylesheet language and keep selectors, declarations, values, at-rules, and the cascade in their proper roles.

Levels: Beginner ~12 min read

Basic

CSS is a stylesheet language

CSS describes presentation rules for a document. A stylesheet is a sequence of rules and at-rules; the rules are interpreted against a document, and matching declarations contribute values that the cascade can later resolve.

Interactive Runnable example
Edit

Ready to run.

The pieces have different jobs

A selector describes which elements a rule matches. A declaration contains a property and its value. A declaration block groups declarations. The stylesheet contains these constructs, while the cascade decides which applicable declarations win. These jobs are related, but they are not interchangeable.

css
1
2
3
4
card {
  color: navy;
  padding: 1rem;
}

Quick check

In the rule below, what is `color: navy`?

Rules can contain several declarations

A declaration block can contain several declarations. Each declaration has its own property grammar and can independently be valid or invalid. This is why a mistake in one declaration does not automatically turn every other declaration in the block into the same property.

Interactive Runnable example
Edit

Ready to run.

At-rules are part of the stylesheet language

CSS also has at-rules, which begin with an at-keyword such as `@media` or `@supports`. An at-rule can contain declarations indirectly by containing qualified rules or other at-rules. The conditions and syntax of each at-rule belong to the specification that defines it.

Interactive Runnable example
Edit

Ready to run.

A stylesheet is not a bag of properties

CSS works as a language with syntax, matching, value definitions, cascading, and layout or presentation models. Learning isolated properties without those shared mechanisms makes later CSS harder to predict. The curriculum therefore teaches shared mechanisms once and lets specialized modules own their algorithms.

Specification boundary

The W3C CSS Working Group publishes CSS as coordinated modules rather than one monolithic specification. CSS Snapshot 2026 records the state of those modules for the year; individual modules remain the authority for their own syntax and processing models.

Normative starting points: CSS Snapshot 2026 and CSS Syntax Level 3.

Quick check

If you can identify the selector, declaration, declaration block, and at-rule in a stylesheet, you have the vocabulary needed for the more specialized CSS lessons that follow.

Was this page helpful?

Mark this learning resource complete to track your learning progress.