
CSS Box Model
Every HTML element is a box consisting of:
- Content – The actual text or image.
- Padding – Space between content and border.
- Border – The outline around an element.
- Margin – Space outside the border.
Example
div {
padding: 10px;
border: 2px solid black;
margin: 20px;
}
Understanding the box model is key to proper spacing and layout control.
CSS Flexbox
Flexbox makes it easier to create responsive layouts.
Basic Flexbox Example
.container {
display: flex;
justify-content: space-between;
}
This arranges items in a flexible, adaptable way—great for modern web design.


