div 内的垂直线

发布于 2024-11-27 02:56:19 字数 440 浏览 1 评论 0原文

jsFiddle

我在 div 中有一条“垂直规则”(实际上是 border-right)。然而,我很难让它跨越整个容器。我尝试修改边距(尝试删除 #vrmargin-top: 20px; 的注释,但无济于事。

另外,我该如何制作 #wrapper 扩展以适应其内容?

:抱歉,我正在尝试解决 #wrapper 中的填充问题,因为它对于其他事情是必要的。

编辑 一个href="http://jsfiddle.net/Gfn9U/5/" rel="nofollow">我已经解决了:或者有更干净的方法吗?

jsFiddle

I have a "vertical rule" within a div (actually the border-right of a nested div). However, I am having trouble making it span the whole of its container. I have tried modifying the margins (try removing the comments from margin-top: 20px; in the #vr but to no avail.

Also, how do I make the #wrapper expand to fit its contents?

EDIT: Sorry, I was unclear. I am trying to work around the padding in the #wrapper because it's necessary for other things.

EDIT: I've worked it out: or is there a cleaner way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

填充需要是 #vr 的属性 这看起来正确吗? http://jsfiddle.net/Gfn9U/4/

the padding needs to be a property of #vr Does this look right? http://jsfiddle.net/Gfn9U/4/

梦过后 2024-12-04 02:56:19

这是因为包装器中的填充

使顶部和底部填充为0px

#wrapper {
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 0px;
    padding-bottom: 0px;
}

It's because of the padding in the wrapper

Make the top and bottom paddings 0px

#wrapper {
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 0px;
    padding-bottom: 0px;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文