What is CSS¶
CSS stands for Cascading Style Sheets. CSS is used to style the content of a web page by adding design elements like colors, fonts, and spacing. You can use CSS to change the look and feel of any element on a web page, from the overall layout to individual HTML tags.
Getting Started¶
We import stylesheets in the section of our HTML.
<link rel="stylesheet" href="styles.css">
| Attribute | Value | Meaning |
|---|---|---|
rel |
stylesheet |
Relationship between the linked resource and the document |
href |
styles.css |
Hypertext reference, the path to your CSS file |
CSS Syntax¶
A CSS rule has three parts: a selector, a property, and a value.
selector {
property: value;
}
| Part | Description |
|---|---|
selector |
Targets the HTML element to style |
property |
The style attribute you want to change |
value |
The value applied to that property |
Example:
h1 {
color: red;
font-size: 32px;
}
This targets every <h1> element and makes the text red at 32px.