CSS border-style property specify the line style of a box’s border (solid, double, dashed, etc.).
CSS property border-style
| CSS version: | CSS 2.1 |
| Value: | [none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset]{1,4} | inherit |
| Initial: | none (individual properties) |
| Applies to: | all elements |
| Inherited: | no |
- When four values are specified this is the order:
border-top-style, border-right-style, border-bottom-style, border-left-style
-
When less than four values are specified:
h1 { border-style: solid } /* solid solid solid solid */ h1 { border-style: solid dashed } /* solid dashed solid dashed */ h1 { border-style: solid dashed dotted } /* solid dashed dotted dashed */ border-stylemust be set to something other thannoneand border-width should be > 0 forborder-colorto be applicable.
Example – border-style – solid, dotted, dashed
<style type="text/css">
.box {
width: 100px; height: 100px;
border-style: solid dotted dashed;
}
</style>
<div class="box">
Hello world in div
</div>Example – border-style – double
<style type="text/css">
.box {
width: 100px; height: 100px;
border-style: double;
}
</style>
<div class="box">
Hello world in div
</div>Example – border-style – groove
<style type="text/css">
.box {
width: 100px; height: 100px;
border-style: groove;
}
</style>
<div class="box">
Hello world in div
</div>Example – border-style – ridge
<style type="text/css">
.box {
width: 100px; height: 100px;
border-style: ridge;
}
</style>
<div class="box">
Hello world in div
</div>Example – border-style – inset
<style type="text/css">
.box {
width: 100px; height: 100px;
border-style: inset;
}
</style>
<div class="box">
Hello world in div
</div>Example – border-style – outset
<style type="text/css">
.box {
width: 100px; height: 100px;
border-style: outset;
}
</style>
<div class="box">
Hello world in div
</div>Related
- CSS border - define border properties of an element
- CSS border-width - set element border width of four sides
- CSS border-color - define color of four borders
- CSS border radius and round corners examples