CSS stands for Cascading Style Sheets.
CSS describes how HTML elements should be displayed on screen, paper, or other media.
CSS is used to control the appearance, layout, spacing, colors, and typography of web pages.
color: red;
A CSS rule consists of a selector and a declaration block.
The selector points to the HTML element you want to style.
A declaration contains a property and a value.
h1 { color: blue; }
p { font-size: 16px; }
CSS selectors are used to find or select the HTML elements you want to style.
There are several types of selectors in CSS:
- Element Selector
- Class Selector
- ID Selector
- Universal Selector
- Grouping Selector
p { color: black; }
All HTML elements can be considered as boxes.
The CSS box model includes content, padding, borders, and margins.
- Content
- Padding
- Border
- Margin
margin: 10px;
padding: 15px;
Responsive web design makes web pages look good on different screen sizes and devices.
Media queries can be used to apply different styles depending on the screen size.
@media (min-width: 768px) {
.container {
width: 80%;
}
}