
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
The border-style Property in CSS
The CSS border-style property is used to specify the border style for an element. We can also define border-style for individual sides using border-top-style, border-right-style, border-left-style and border-right-style properties.
Syntax
The syntax of CSS border property is as follows −
Selector { border: /*value*/ }
The following examples illustrate CSS border-style property −
Example
<!DOCTYPE html> <html> <head> <style> div:first-of-type { margin: 5% 0 0 20%; } div { height: 40px; width: 40px; margin: auto; padding: 10px; border-style: solid; display: flex; float: left; } #d1 { border-style: double dashed; } #d2 { border-style: dotted; } </style> </head> <body> <div></div> <div id="d1"></div> <div id="d2"></div> </body> </html>
Output
This gives the following output −
Example
<!DOCTYPE html> <html> <head> <style> div { margin: 20px; float: left; height: 80px; width: 60px; border-style: ridge; border-width: 1.2em; border-color: midnightblue; border-bottom-left-radius: 50%; } div + div { height: 120px; width: 80px; border-style: double; border-color: seagreen; border-right-width: 180px; border-bottom-right-radius: 100%; } </style> </head> <body> <div></div> <div></div> </body> </html>
Output
This gives the following output −
- Related Articles
- Usage of border-style property in CSS
- Usage of border-bottom-style property in CSS
- Usage of border-top-style property in CSS
- Usage of border-left-style property in CSS
- Usage of border-right-style property in CSS
- HTML DOM Style border Property
- The border-color Property in CSS
- The border-width Property in CSS
- The border Shorthand Property in CSS
- The outline-style Property in CSS
- Animate CSS border property
- CSS border-radius property
- CSS border-image property
- Set the style of the border with CSS
- Change the style of top border with CSS

Advertisements