Html 我们如何在网页中绘制一条垂直线?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7512877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 10:43:37  来源:igfitidea点击:

How can we draw a vertical line in the webpage?

htmlcss

提问by amir

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

对于水平,它是<hr>。但对于垂直线?

回答by C Travel

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

您也可以<hr>用于垂直线。
根据需要设置widthto1和 size(height)。
我在示例(演示)中使用了 500

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

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

DEMO

演示

回答by Andres Ilich

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.

html 中没有垂直线可供您使用,但您可以通过将 div 绝对定位在容器外top:0;并使用 a和bottom:0;样式来伪造一条。

Try this:

尝试这个:

CSS

CSS

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

HTML

HTML

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

Demo

演示

回答by Thomas

That's no struts related problem but rather plain HMTL/CSS.

这不是与 struts 相关的问题,而是简单的 HMTL/CSS。

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

我不是 HTML 或 CSS 专家,但我想您可以使用仅在左侧或右侧带有边框的 div。

回答by AlexR

<hr>is not from struts. It is just an HTML tag.

<hr>不是来自struts。它只是一个 HTML 标签。

So, take a look here: http://www.microbion.co.uk/web/vertline.htmThis link will give you a couple of tips.

所以,看看这里:http: //www.microbion.co.uk/web/vertline.htm这个链接会给你一些提示。