CSS - 为什么高度似乎已设置,但实际上并未设置?

发布于 2024-08-21 04:49:00 字数 425 浏览 15 评论 0原文

好吧,这真的很烦人,我不明白为什么会发生这种情况。 当我试图让CSS粘页脚工作时,我可能搞砸了一些东西。

我正在进行一项,但身体似乎不是液体,所以我想尝试一下这个: http://ryanfait.com/sticky-footer/

但结果却是这样的: http://www.serverbart.com/film/

蓝色框应该类似于画廊,所以不用介意颜色:p 我想您会明白我想要做什么,并且我愿意接受有关重新设计 div 结构的意见!我正在尝试真正擅长不同的布局,而这个布局一直困扰着我。

Ok, this is really annoying and I can't understand why this is even happening.
I may have screwed some stuff up when trying to get the CSS Sticky footer to work.

I had one going on, but it seemed at the body wasn't liquid so I thought I'd try this one:
http://ryanfait.com/sticky-footer/

But the results ended up like this:
http://www.serverbart.com/film/

The blue box is supposed to resemble a gallery, so nevermind the color :p
I guess you'll understand what I'm trying to do, and I'm open for input about redesigning the div structure! I'm trying to get really good at different layouts and this one has been bugging me a bit.

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

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

发布评论

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

评论(3

沉溺在你眼里的海 2024-08-28 04:49:00

你没有效仿 Ryan Fait 的榜样。对于初学者来说,推送进入包装器内部。

You are not following Ryan Fait's example. For starters, the push goes inside wrapper.

爱冒险 2024-08-28 04:49:00

这是因为你有这个:

<div id="mainWrapper">
    <div id="content"></div>
    <div id="push"></div>
    <div id="footer"></div>
</div>

我花了很长时间才弄清楚我第一次创建粘性页脚时做错了什么,它必须是这样的

<div id="mainWrapper">
    <div id="content"></div>
    <div id="push"></div>
</div>

<div id="footer">
</div>

你必须明确地将 2 个 div 作为最外层的 div,而不仅仅是一个主要包装。

It's because you have this:

<div id="mainWrapper">
    <div id="content"></div>
    <div id="push"></div>
    <div id="footer"></div>
</div>

It took me forever to figure out what i was doing wrong the first time i created a sticky footer as well and it has to be like this

<div id="mainWrapper">
    <div id="content"></div>
    <div id="push"></div>
</div>

<div id="footer">
</div>

You have to explicitly have 2 divs as your outermost divs, not just one main wrapper.

星星的轨迹 2024-08-28 04:49:00

推送和页脚的高度必须相同。推力必须进入包装纸内部。

The height for the push and the footer must be the same. The push must go inside the wrapper.

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