CSS div页脚和列高问题

发布于 12-19 15:48 字数 646 浏览 1 评论 0原文

我这里有两个问题: http://jsfiddle.net/BtGtT/3

The第一个问题是页脚应始终位于页面底部,因此如果我将“otherContent”div更改为 75px 而不是 1500px,页脚应保留在页面底部页面(当我将其改回 1500px 时,不在中间)。我不知道如何更新我的 CSS 来实现这一点。

第二个问题是我需要“contentLeft”和“contentRight”div始终与“contentCenter”相同高度<代码>div。因此,当我像 JSFiddle 中那样将“otherContent”div 更新为 75px 或 1500px 时,“contentLeft”和“contentRight”div 应该与之匹配。这可能吗?

在我的实际网页中,我有一个 控件,其中的内容可能具有不同的高度。我想让我的侧栏与中心内容的高度相同。

I've got two problems here: http://jsfiddle.net/BtGtT/3

The first problem is that the footer should always be at the bottom of page, so if I change my "otherContent" div to be 75px instead of 1500px, the footer should remain at the bottom of the page (and not in the middle when I change it back to 1500px). I'm not sure how to update my CSS to make that happen.

The second problem is that I need my "contentLeft" and "contentRight" divs to always be the same height as my "contentCenter" div. So when I update my "otherContent" div to be 75px or 1500px like in the JSFiddle, the "contentLeft" and "contentRight" divs should match that. Is this possible?

In my actual web page, I've got an <ASP:ContentPlaceHolder> control and the content within could be of varying height. I'd like to keep my side columns the same height as whatever the center content might be.

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

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

发布评论

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

评论(2

二智少女2024-12-26 15:48:42

粘性页脚假列

更多信息:

阅读这个。 CSS(至少是 2)确实在解决这个问题。因此,您的一些选择是:

  • 使用 repeat-y 平铺图像以给出全长列的错觉
    • 如果您可以接受一些优雅的降级,那么渐变也可以发挥作用
  • 使用伪元素
  • CSS3 Flexbox

所有这些都有其优点,以及不同的浏览器支持。

只需阅读这篇文章

Sticky Footer and Faux Columns

More information:

Read this. CSS(2, at least) really struggles with this problem. So a few of your options are:

  • Tiling an image with repeat-y to give the illusion of full length columns
    • Gradients also work if you can accept some graceful degradation
  • Using Pseudo elements
  • CSS3 Flexbox

All of these have their benefits, and differing browser support.

Just read this article.

奢华的一滴泪2024-12-26 15:48:42

在#divFooter 中,去掉position 并使用clear:both。查看这篇文章了解示例作品。

对于其他问题,请查看此示例

In #divFooter, get rid of position and use clear:both. Check this post for an example how clear works.

For the other question, check this example.

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