The border-style property defines how the border looks. Common values include:
soliddotteddasheddoublenonediv {
border-style: solid;
}Use border-width to set how thick the border appears.
div {
border-width: 3px;
}The border-color property sets the border’s color. You can use named colors, hex, RGB, etc.
div {
border-color: green;
}CSS allows you to style each side of an element’s border individually — top, right, bottom, and left. This is useful when you want different widths, styles, or colors on each side.
border-top – Sets width, style, and color for the top borderborder-right – Sets width, style, and color for the right borderborder-bottom – Sets width, style, and color for the bottom borderborder-left – Sets width, style, and color for the left borderdiv {
border-top: 3px solid red;
border-right: 2px dashed green;
border-bottom: 4px dotted blue;
border-left: 5px double orange;
}You can style only one side without affecting the others:
p {
border-bottom: 2px solid black;
}You can also combine different border sides with the border shorthand while overriding specific sides if needed:
div {
border: 2px solid gray;
border-top: 5px solid red; /* overrides top side */
}You can combine border-style, border-width, and border-color into one property:
div {
border: 2px dashed red;
}The border-radius property rounds the corners of the element’s border.
div {
border-radius: 10px;
}Try this HTML with inline styles:
<div style="border: 4px dashed blue; border-radius: 10px; padding: 20px; margin-bottom: 20px;">
Box with a dashed blue border and rounded corners.
</div>
<div style="border: 1px solid black; border-radius: 0; padding: 20px;">
Box with a solid black border and sharp corners.
</div>Ask the AI if you need help understanding or want to dive deeper in any topic