CSS 容器高度

发布于 2024-10-10 05:53:31 字数 338 浏览 0 评论 0原文

我正在努力解决侧边栏的高度。

我的容器现在显示了正确的高度(内部内容的高度),但应该使用该高度 100% 的侧边栏仍然没有出现。

我已经实现了浮动清除(http://www.quirksmode.org/css/clearing.html),但侧边栏仍然没有出现。

我相信这对专业人士来说是一个简单的问题,任何提示都值得赞赏!

谢谢,

汤姆

这是我的代码: http://jsfiddle.net/tomperkins/wy52B/

I'm struggling with a sidebar height.

My container is now showing the correct height (that of the content inside), but my sidebar that should be using 100% of that height is still not appearing.

I've implemented float clearing (http://www.quirksmode.org/css/clearing.html) but the sidebar's still not appearing.

I'm sure this is a simple one for you pros, any tips appreciated!

Thanks,

Tom

Here's my code: http://jsfiddle.net/tomperkins/wy52B/

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

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

发布评论

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

评论(2

倾城°AllureLove 2024-10-17 05:53:31

将侧边栏更改为

position: absolute;
right: 0;

您还需要将容器更改为 position:relative

Change the sidebar to

position: absolute;
right: 0;

You'll also need to change the container to position: relative.

幸福还没到 2024-10-17 05:53:31

或者你可以使用 jQuery:

var h = $(".sidebar").parent().height();
$(".sidebar").height(h);

Or you can use jQuery:

var h = $(".sidebar").parent().height();
$(".sidebar").height(h);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文