CSS Summary
CSS controls how HTML content looks, including color, spacing, size, typography, and layout.
HTML gives a page its structure. CSS gives that structure a visual design. A CSS rule selects part of the page and then lists the styles that should apply.
p {
color: blue;
font-size: 18px;
}
In this rule, p is the selector. It tells the browser which HTML elements to style. The lines inside the braces are declarations.
CSS Uses Properties And Values
A property is the thing you want to change. A value is the setting you choose for that property.
h1 {
color: green;
margin-bottom: 20px;
}
color and margin-bottom are properties. green and 20px are values.
Selectors Choose What To Style
A selector points to the HTML elements that should receive a style. Selectors can target element names, classes, IDs, and other patterns.
.card {
padding: 20px;
border: 1px solid gray;
}
The CSS Selectors lesson explains how CSS finds the right elements.
Several Rules Can Apply At Once
More than one CSS rule can apply to the same element. When rules disagree, the browser uses the cascade to decide which value wins.
The CSS Cascade lesson explains how source order, specificity, and inheritance affect the final style.
CSS Builds The Page Design
CSS can change individual text styles, but it also controls larger parts of a page. The Box Model lesson explains spacing and sizing, and the Display lesson explains how elements take up space.