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
How can we draw a vertical line in the webpage?
提问by amir
For horizontal it is <hr>
. but for vertical line?
对于水平,它是<hr>
。但对于垂直线?
回答by C Travel
回答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"> </div>
回答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这个链接会给你一些提示。