Fundamental CSS Properties
Below you will find explanations and examples of some essential CSS properties.
Table of Contents
1. Color and Background
Defines text and background colors.
p {
color: red;
background-color: yellow;
}
More information: W3Schools — CSS Colors
2. Typography
Controls font family, size, and style.
h1 {
font-family: Arial, sans-serif;
font-size: 24px;
font-weight: bold;
}
More information: W3Schools — CSS Typography
3. Margins and Padding
Defines external and internal spacing of elements.
div {
margin: 20px;
padding: 10px;
}
More information: W3Schools — CSS Margins and Padding
4. Borders
Allows you to define the borders of elements.
div {
border: 2px solid black;
border-radius: 10px;
}
More information: W3Schools — CSS Borders
5. Flexbox
Flexible layout for organizing elements in rows or columns.
.container {
display: flex;
justify-content: center;
align-items: center;
}
More information: W3Schools — CSS Flexbox