100%身高的问题 [英] Problems with 100% height

查看:177
本文介绍了100%身高的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用宽度为20%,高度为100%的侧面板,以便根据浏览器的宽度和高度等重新调整大小。我的高度有问题(100 %)的CSS部分,但它似乎不适合浏览器窗口的整个高度 - 它只是显示100%的侧面板内容。

I'm trying to use a side panel with a width of 20% and a height of 100% so that they will re-size depending on browser width and height etc. I'm having a problem with the height (100%) part of the CSS, it doesn't seem to fit the entire height of the browser window though - it just displays 100% of what's in the side panel.



无论内部有多少内容,我怎样才能使侧面板到达页面底部?

How can I make the side panel reach the bottom of the page no matter how much content is inside of it?

#sidebar{
    float:left;
    position: relative;
    width: 20%;
    height: 100%;
    background-color: red;
}


推荐答案

身高100%永远是疼痛。

Height 100% is always a pain.

请确保 html,body 也有 height:100%和任何 div 封装它。

Make sure that, html, body also have height: 100% and any div that's wrapping it.

这篇关于100%身高的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆