Code has been added to clipboard!

The CSS Border-Style Property

Reading time 2 min
Published Sep 8, 2017
Updated Oct 1, 2019

Defining the CSS border style

By using the CSS border-style property, you can set custom styles for all four borders of an element:

Example
div.one {border-style: solid dotted dashed dotted;} 
/* top border - solid, right border - dotted, bottom border-dashed, left border - dotted */
div.two {border-style: dashed dotted double;} 
/* top border - dashed, right border - dotted, bottom border - double */
div.three {border-style: dotted dashed;} 
/* top and bottom border - dotted, right and left borders - dashed */
div.four {border-style: dashed;} 
/* all borders - dashed */

Syntax for border styles

To create CSS border styles, follow the syntax example below:

border-style: value;

You can define from one to four values at once.

Syntax Example Explanation
One value border-style: none; The style is the same for all four sides.
Two values border-style: none dotted; The first value defines the style for the top and bottom borders.
The second value defines the style for the left and right borders.
Three values border-style: none dotted dashed; The first value defines the style for the top border.
The second value defines the style for the left and right borders.
The third value defines the style for the bottom border.
Four values border-style: none dotted dashed double; The first value defines the style for the top border.
The second value defines the style for the right border.
The third value defines the style for the bottom border.
The fourth value defines the style for the left border.

See all the possible values for CSS border styles defined in the following section.

Property values

Value Description
none The default value. No border is displayed
hidden No border is displayed
dotted A border of round dots is displayed
dashed A border of short dashes is displayed
solid A single solid border is displayed
double A double border is displayed
groove An inward-curving border is displayed
ridge An outward-curving border is displayed
inset An embedded border is displayed
outset An embossed border is displayed

Browser support

Chrome
1+
Edge
12+
Firefox
1+
IE
4+
Opera
3.5+
Safari
1+

Mobile browser support

Chrome
18+
Firefox
4+
Opera
All
Safari
3+
Tutorial
CSS3 Features
Syntax
Classes
ID Selectors
Attribute Selectors
Stylesheets
Inline
Internal
External
Box Model
Children Selectors
Pseudo Classes
Pseudo Elements
Variables
Counters
Text
Fonts
Web Fonts
Backgrounds
Background Images
Colors
Gradients
Opacity / Transparency
Shadow Effects
Transitions
Tooltip
Transform
Animations
Layout — Display
Layout — Position
Layout — Float
Layout — Clear
Layout — Horizontal & Vertical Align
Multiple Columns
Introduction
Responsive Web Design — Viewport
Responsive Web Design — Grid View
Responsive Web Design — Media Queries
Responsive Web Design — Flexbox Layout
Responsive Web Design — Images
Responsive Web Design — Videos
Borders
Margin
Padding
Width
Height
Outline
Links
Lists
Tables
Dropdown Menu
Navigation Bar
Images
Image Gallery
Border Images
Forms
Rounded Corners
Buttons
Box-Sizing
Selector Reference
Pagination Examples
Code Examples
CSS3 Browser Support Reference
Functions Reference
Speech Module Reference
Units
Web Safe Font Combinations
Cheat Sheet
:hover
@font-face
@keyframes
@media
align-content
align-items
align-self
all
animation
backface-visibility
background
background-clip
background-color
background-image
background-origin
background-position
background-size
border
border-image
border-radius
border-style
box-shadow
box-sizing
color
columns
filter
flex
flex-basis
flex-direction
flex-flow
flex-grow
flex-shrink
flex-wrap
font
font-family
font-size
font-size-adjust
font-stretch
font-style
font-weight
hanging-punctuation
justify-content
line-height
margin
offset
opacity
order
outline
overflow
padding
perspective
position
resize
tab-size
text-align
text-decoration
text-emphasis
text-transform
text-shadow
transform
transition-property
translate
vertical-align
word-break
word-wrap
z-index