To create a vertical line with CSS, the code is as follows −
Example
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> .vLine { border-left: 6px solid rgb(128, 0, 128); height: 500px; margin-left: 5%; } </style> </head> <body> <h1>Vertical Line Example<h1> <div class="vLine"></div> </body> </html>
Output
The above code will produce the following output −