🚨 Get Your Free NFT Certificate Mint by Completing the Web3 Exam! START NOW

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.

DataCamp
Pros
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
Udemy
Pros
  • Easy to navigate
  • No technical issues
  • Seems to care about its users
Main Features
  • Huge variety of courses
  • 30-day refund policy
  • Free certificates of completion

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

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

Mobile browser support

Browser image
Chrome
18+
Browser image
Firefox
4+
Browser image
Opera
All
Browser image
Safari
3+