
- 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-width Property in CSS
The CSS border-width property is used to specify the width for border of an element. We can also set width for individual sides using border-top-width, border-right-width, border-left-width and border-right-width properties.
Syntax
The syntax of CSS border-width property is as follows−
Selector { border-width: /*value*/ }
Example
The following examples illustrate CSS border-width property −
<!DOCTYPE html> <html> <head> <style> #main { border-bottom-width: 20px; border-bottom-left-radius: 40px; border-bottom-right-radius: 40px; } div { margin: auto; height: 100px; width: 80px; border-style: double; border-width: 5px; } div > div { margin-top: 15px; height: 50px; width: 50px; border-style: dashed; border-color: red; border-width: thin; text-align: center; line-height: 50px; } </style> </head> <body> <div id="main"> <div>demo</div> </div> </body> </html>
Output
This gives the following output −
Example
<!DOCTYPE html> <html> <head> <style> p { padding: 2%; border-style: ridge; border-width: 4px; border-color: indianred; } q { border-style: solid; border-width: thin; text-align: center; font-style: italic; } </style> </head> <body> <p> Student details are covered here. </p> <hr> <q>Education is the most powerful weapon which you can use to change the world.</q> </body> </html>
Output
This gives the following output −
- Related Articles
- Usage of border-width property in CSS
- Animate CSS border-left-width property
- Animate border-top-width CSS property
- Usage of border-bottom-width property in CSS
- Usage of border-right-width property in CSS
- Usage of border-top-width property in CSS
- Usage of border-left-width property in CSS
- Which property specifies the width of a border in CSS?
- Perform Animation on border-bottom-width CSS property
- CSS border-image-width
- Set border width with CSS
- Set the border image width with CSS
- CSS width property
- The border-style Property in CSS
- The border-color Property in CSS

Advertisements