How can we draw a vertical line on a web page?

For horizontal value <hr>. but for a vertical line?

+5
source share
5 answers

You can use <hr>for vertical line.

Set widthto 1and size (height) as much as you want.

I used 500 in my example (demo):

WITH <hr width="1" size="500">

Demo

+17
source

There are no vertical lines in html that you can use, but you can fake one by absolutely positioning the div outside your container using the top:0;and style bottom:0;.

Try the following:

CSS

.vr {
    width:10px;
    background-color:#000;
    position:absolute;
    top:0;
    bottom:0;
    left:150px;
}

HTML

<div class="vr">&nbsp;</div>

Demo

+6
source

This is not a problem related issue, but simple HMTL / CSS.

I'm not an expert in HTML or CSS, but I think you could use a div with a border only on the left or right side.

+1
source

@Andres, you can simplify yours a bit more ..
CSS

vr {
    display: block;
    width:10px;
    background-color:#000;
    position:absolute;
    top:0;
    bottom:0;
    left:150px;
}

HTML

<vr />

Demo

+1
source

All Articles