Contents
Defining the CSS border style
By using the CSS border-style
property, you can set custom styles for all four borders of an element:
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.
- 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
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid Certificates of completion
- A wide range of learning programs
- University-level courses
- Easy to navigate
- Verified certificates
- Free learning track available
- University-level courses
- Suitable for enterprises
- Verified 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 |