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!
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
More Posts related to CSS,
- How to create a circular Image using pure CSS Code
- Horizontally Center Align tag in HTML using CSS
- Add scroll to div element in HTML Css
- Change CSS Background Opacity with Examples
- How to make text bold using CSS
- How to place two div elements next to each other
- Vertically Center Text in a DIV Element
- align image at middle of div element
- Tailwind CSS Hello World Example
- How to make div or text in html unselectable using CSS
- Only Chessboard using HTML and CSS Code Example
- Simple CSS Grid Example
- How to set CSS background-Image Property
- CSS Background Opacity with Examples
- reCAPTCHA Implementation Tutorial
- List of 32 CSS cursors web developers must know about
- How to Vertically Center Align Text in a Div using CSS Code Example
- 10 Must Know CSS Border Styles with Examples
- Tutorial : Simple Lightweight Pure CSS based Vertical Navigation Menu
- CSS: Apply opacity only for div background and not text
- Set Falling Show on Website for Christmas using Pure CSS Code
- How to make jsfiddle bootstrap ready
- Elegant CSS Box Shadows Ideas
- Responsive Web Design with CSS Media Queries: A Beginner's Tutorial [Updated for 2023]
- How to Center Align Image in Bootstrap
More Posts:- How to perform Find and Replace using vim Editor - vi
- How to update Rust on Mac/Linux - Rust
- SharePoint Server 2016 Preview installation error - This Product Key isn't a valid Microsoft Office 2016 Product Key. Check that you've entered it correctly. - SharePoint
- How to Save Eclipse console logs in external log file - Eclipse
- Android Development: Spinners with Example - Android
- MySQL: How to know which Database Schema you are on in Terminal - MySQL
- Get the file location of git config values - Git
- PowerShell For Each Loop Examples - Powershell