You can add a vertical line to your HTML page by using the <div> tag with custom CSS styling. Let’s dive into the details.

You can create a vertical line in CSS by changing the color of the left (or right) border of an empty <div>.

<style>
.verticalLine {
  border-left: 5px solid red;
  height: 200px;
}
</style>

<div class="verticalLine"></div>

To change the position of the vertical line in HTML and CSS, you can just reposition the <div> or change its alignment.