How to add a border with CSS

You can use CSS to apply borders to almost any element like images, text, div-tags etc. A border CSS style could look like this…

border:1px solid #2a2a2a;

This style would add a solid border with a width of 1px and the color #2a2a2a. You can set any border width and a border can have different styles like dotted, dashed, solid, double, groove, ridge, inset, outset, none or hidden. Likewise you can set any color you like.

  Written by: Michael from     07-09-2022     Written in: CSS tutorials


  • Gabriella says:

    Wow, this tutorial on how to add a border with CSS is so helpful! I’ve always struggled with getting my borders right, but this article breaks it down so clearly . The step-by-step instructions and examples make it easy for me to follow along and apply it to my own website. Thanks to this guide, I can now add stylish borders effortlessly. Can’t wait to experiment with different styles and colors! Keep up the great work!

  • Ryan says:

    I’m not a big fan of this tutorial . While it does cover the basics of adding a border with CSS, I found the explanation to be quite vague. Some crucial steps were skipped, assuming the reader already has a certain level of knowledge. It would have been helpful to see more examples and have a clear explanation of the different border properties and their values. Overall, I think this tutorial lacks depth and clarity.

Leave a Reply

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