CSS stands for Cascading Style Sheets. It is the language used to describe the presentation of a web page — including its colors, layout, fonts, and animations. While HTML defines the structure and content of a page, CSS controls how that content looks and feels.
Without CSS, every HTML page would look plain and unstyled — just black text on a white background. CSS gives web designers the power to:
CSS is applied to HTML elements using rules. A CSS rule consists of a selector and a declaration block:
/* This rule makes all <h1> elements blue and centered */
h1 {
color: blue;
text-align: center;
}
| Part | Example | Description |
|---|---|---|
| Selector | h1 |
Points to the HTML element you want to style |
| Property | color |
The style attribute you want to change |
| Value | blue |
The value assigned to the property |
| Declaration | color: blue; |
A property + value pair, ending with a semicolon |
There are three ways to insert CSS into an HTML document:
The most common and recommended method. A separate .css file is linked in the <head> of your HTML:
<link rel="stylesheet" href="styles.css">
CSS is written inside a <style> tag within the <head> section:
<style>
body {
background-color: #f0f0f0;
}
</style>
CSS is applied directly to a single HTML element using the style attribute:
<p style="color: red; font-size: 18px;">This is a red paragraph.</p>
| Year | Version |
|---|---|
| 1996 | CSS1 (W3C Recommendation) |
| 1998 | CSS2 (W3C Recommendation) |
| 2011 | CSS2.1 (revised standard) |
| 2012+ | CSS3 (modular — ongoing) |
| Present | CSS Living Standard (W3C) |