Connect with us

CSS

CSS Border Styles: How Many Are There?

Spread the love

In modern web design, borders do much more than just outline elements โ€” they help define structure, create visual emphasis, and improve user experience. CSS makes it easy to apply borders using the border-style property. But how many styles does CSS offer?

๐Ÿ‘‰ There are 10 official border styles in CSS โ€” each offering a unique visual effect.


โœ… List of All CSS Border Styles

Below are the 10 CSS border styles, with a brief description of what each one does:

StyleDescription
noneNo border is displayed.
hiddenSimilar to none, but used in table elements to override other borders.
solidA single, straight, solid line.
dashedA series of short dashes.
dottedA series of round dots.
doubleTwo solid lines separated by space.
grooveGives the border a 3D grooved look using shading.
ridgeOpposite of groove, creating a raised 3D look.
insetMakes the element appear embedded (pressed in).
outsetMakes the element appear pushed out (raised).

โœ… How to Use border-style in CSS

To apply a border style, use the border-style property in your CSS:

.box {
  border: 3px solid black;
}

You can replace solid with any of the 10 styles listed above.


โœ… Apply Different Styles to Each Side

CSS allows separate styles for top, right, bottom, and left:

div {
  border-top-style: dotted;
  border-right-style: solid;
  border-bottom-style: dashed;
  border-left-style: double;
}

This flexibility is especially useful in creative UI design and layout customization.


โœ… Combine with Color and Width

You can also combine border-style with border-color and border-width:

.card {
  border: 2px ridge #007bff;
}

This creates a 3D ridge border with a custom color.


๐Ÿงพ Summary Table

CSS PropertyPurpose
border-styleSets how the border looks
border-widthSets how thick the border is
border-colorSets the color of the border

๐Ÿง  Final Thoughts

There are 10 official CSS border styles, ranging from simple (solid, dashed) to decorative (groove, ridge, double). Mastering these styles gives you the power to shape your design precisely โ€” whether you’re styling buttons, cards, tables, or layouts.


Pro Tip: When in doubt, start with solid or dashed for clean, modern UI โ€” and experiment with ridge, groove, or double for creative flair.


Spread the love
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *