How to add a vertical line in Html using CSS
In this tutorial, we will learn how to add a vertical line to an HTML page with the help of CSS.
Consider we have a div
element with a container
class.
<div class="container"></div>
To add a vertical line to the div
element, we can use the height
and border-left
CSS properties.
Here is an example:
.container{
height: 50px;
border-left: 1px solid #0000;
}
The above code adds the vertical line on the left side of an HTML element.
In case, if you want to add the vertical line to the right side of an element, we can use the border-right
CSS property.
.container{
height: 50px;
border-right: 1px solid #0000;
}