如何使用HTML制作一条垂直线?


当前回答

没有与<hr>元素等值的垂直元素。然而,你可能想尝试的一种方法是在你要分离的东西的左边或右边使用一个简单的边界:

# your_col { Border-left: 1px纯黑色; } < div id = " your_col " > 你的内容在这里 < / div >

其他回答

我需要一条内联的垂直线,所以我把一个按钮变成了一条直线。

<button type="button" class="v_line">l</button>

.v_line {
         width: 0px;
         padding: .5em .5px;
         background-color: black;
         margin: 0px; 4px;
        }

您还可以使用HTML水平线<hr />创建一条垂直线

Html, body{height: 100%;} 人力资源。垂直{ 宽度:0 px; 高度:100%; /*或PX */中的高度 } <hr class="vertical" />

要在div中创建一条居中的垂直线,我认为你可以使用这段代码。 “容器”可能是100%的宽度,我猜。

div.container { 宽度:400 px; } div.vertical-line { Border-left: 1px solid #808080; 身高:350 px; margin-left:汽车; margin-right:汽车; 宽度:1 px; } < div class = "容器" > < div class = "垂直线”>,< / div > < / div >

没有与<hr>元素等值的垂直元素。然而,你可能想尝试的一种方法是在你要分离的东西的左边或右边使用一个简单的边界:

# your_col { Border-left: 1px纯黑色; } < div id = " your_col " > 你的内容在这里 < / div >

垂直到div

<div style="width:50%"> <div style="border-right:1px solid;"> <ul> <li> Empty div didn't shows line </li> <li> Vertical line length depends on the content in the div </li> <li> Here I am using inline style. You can replace it by external style or internal style. </li> </ul> </div> </div>

到div左边的垂直线

<div style="width:50%"> <div style="border-left:1px solid;"> <ul> <li> Empty div didn't shows line </li> <li> Vertical line length depends on the content in the div </li> <li> Here I am using inline style. You can replace it by external style or internal style. </li> </ul> </div> </div>