Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we draw a vertical line in the webpage? [duplicate]

Tags:

html

css

For horizontal it is <hr>. but for vertical line?

like image 611
amir Avatar asked Sep 22 '11 09:09

amir


People also ask

How do you make a vertical line on a website?

The <hr> tag in HTML is used to produce a horizontal line. However, there is no tag for creating a vertical line. The border-left CSS attribute can be used to simulate a vertical line. The border-left property of CSS is used to style the left-side border.

How do you draw a vertical line in HTML?

To make a vertical line, use border-left or border-right property. The height property is used to set the height of border (vertical line) element. Position property is used to set the position of vertical line.

What we use for vertical line in HTML?

A vertical line can be created in HTML using transform property in <hr> tag. With the help of this property, you can rotate a horizontal line to a vertical line.

How do you make two vertical lines in HTML?

Answer: Use the CSS border Property You can use the CSS border property on a <span> element in combination with the other CSS property like display and height property to make vertical lines in HTML.


2 Answers

You can use <hr> for a vertical line as well.
Set the width to 1 and the size(height) as long as you want.
I used 500 in my example(demo):

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

DEMO

like image 180
C Travel Avatar answered Oct 19 '22 22:10

C Travel


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

Try this:

CSS

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

HTML

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

Demo

like image 39
Andres Ilich Avatar answered Oct 19 '22 23:10

Andres Ilich