10 Must Know CSS Border Styles with Examples


Most of us are aware of just a few CSS Border style options - solid, dotted or dashed. But do you know there are more, and some of them are pretty awesome!

CSS Border Style - Inset

Let's take a look at 10 such must-know CSS border styles with examples.

Example 1: Dotted

<style>
      .border-dotted {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: dotted;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-dotted">CSS Border Style Dotted</div>
CSS Border Style Dotted


Example 2: Dashed

<style>
      .border-dashed {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: dashed;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-dashed">CSS Border Style Dashed</div>
CSS Border Style Dashed


Example 3: Solid

<style>
      .border-solid {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: solid;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-dashed">CSS Border Style Solid</div>
CSS Border Style Solid


Example 4: Double

<style>
      .border-double {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: solid;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-double">CSS Border Style Double</div>
CSS Border Style Double


Example 5: Groove

<style>
      .border-groove {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: groove;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-groove">CSS Border Style Groove</div>
CSS Border Style Groove


Example 6: Ridge

<style>
      .border-ridge {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: ridge;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-ridge">CSS Border Style Ridge</div>
CSS Border Style Ridge


Example 7: Inset

<style>
      .border-inset {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: inset;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-inset">CSS Border Style Inset</div>
CSS Border Style Inset


Example 8: Outset

<style>
      .border-outset {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: outset;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-outset">CSS Border Style Outset</div>
CSS Border Style Outset


Example 9: Hidden

<style>
      .border-hidden {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: ridge;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-hidden">CSS Border Style Hidden</div>
CSS Border Style Hidden


Example 10: None

<style>
      .border-none {
        background-color: lightgrey;
        width: 200px;
        height: 100px;
        padding: 20px;
        border: 1px;
        border-width: 5px; 
        border-style: none;
        border-color: red;
        border-radius: 10px;
      }
</style>
    
  <div class="border-none">CSS Border Style None</div>
CSS Border Style None

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap