CSS Borders
CSS
What is a CSS Border? A border is a line that goes around the edges of an element. CSS allows you to customize its:
- Width
- Style
- Color
- Radius (for rounded corners)
1. border
A shorthand property that sets width + style + color in one line:
2. border-width
Controls the thickness of the border:
- You can also control each side separately:
- border-top-width: 2px;
- border-right-width: 5px;
3. border-style
Sets the type of line used:
4. border-color
Sets the color of the border:
You can use:
- Named colors: red
- Hex: #ff0000
- RGB: rgb(255, 0, 0)
5. border-radius
Makes the corners rounded:
- You can round individual corners too:
- border-top-left-radius: 10px;
- border-bottom-right-radius: 20px;