CSS Detailed Notes
CSS Detailed Notes
What is CSS?
CSS (Cascading Style Sheets) is used to style and layout HTML elements like setting colors, fonts, spacing,
Types of CSS
Syntax
Selectors
- Universal: * {}
- Element: p {}
- Class: .className {}
- ID: #idName {}
- Grouping: h1, p {}
- Descendant: div p {}
- Pseudo-class: a:hover {}
Box Model
- Padding
- Border
- Margin
CSS Units
Positioning
Layout Systems
Flexbox:
.container {
display: flex;
justify-content: space-between;
align-items: center;
Grid:
.container {
display: grid;
gap: 20px;
}
Media Queries (Responsive Design)
body {
background-color: lightblue;
CSS3 Features
- Transitions
button {
- Transforms
div:hover {
transform: scale(1.2);
- Animations
@keyframes fadeIn {
to {opacity: 1;}
- Variables
:root {
--main-color: #3498db;
}
body {
color: var(--main-color);
- Shadows