gpt4 book ai didi

html - 如何在 CSS 中创建 100% 垂直线

转载 作者:技术小花猫 更新时间:2023-10-29 12:23:42 24 4
gpt4 key购买 nike

我想像这样创建一条覆盖整个页面的垂直线

enter image description here

这是我的代码

#menu
{
border-left: 1px solid black;
height: 100%;
}

结果是这样的 enter image description here

最佳答案

使用绝对定位的伪元素:

ul:after {
content: '';
width: 0;
height: 100%;
position: absolute;
border: 1px solid black;
top: 0;
left: 100px;
}

Demo

关于html - 如何在 CSS 中创建 100% 垂直线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13221416/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com