What is CSS?
CSS (Cascading Style Sheets) is the language used to style HTML. It controls colors, fonts, spacing, layout, and animation — everything about how a page looks, without changing the underlying content.
How CSS Works
CSS works by selecting HTML elements and applying rules to them. A rule is made up of a selector (which elements to target) and a declaration block (which styles to apply).
Your First CSS Rule
<style>
p {
color: steelblue;
font-size: 20px;
}
</style>
<p>This paragraph is styled with CSS.</p>
<p>So is this one — the rule applies to every <p>.</p>Quick Facts
| Feature | Value |
|---|---|
| Stands For | Cascading Style Sheets |
| First Released | 1996 |
| Maintained By | W3C (CSS Working Group) |
| File Extension | .css |
| Works With | HTML and JavaScript |
The Cascade
"Cascading" describes how CSS resolves conflicts when multiple rules target the same element — styles cascade based on source order, specificity, and importance, with later, more specific, or "!important" rules typically winning.
What CSS Can Control
- Colors and backgrounds
- Typography — fonts, size, spacing
- Layout — position, size, and alignment of elements
- Responsive behavior across screen sizes
- Transitions and animations
HTML, CSS, and JavaScript
HTML provides structure, CSS provides presentation, and JavaScript provides behavior. Learning HTML first makes CSS click faster, since every CSS rule needs elements to target.
Best Practice
Keep style out of your HTML as much as possible — use CSS rules in a stylesheet rather than inline styles, so your markup stays clean and your styling stays reusable.