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 −
