<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 6 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 6 年前。
我正在尝试制作一个占窗口 100% 的 div(为此我在 css 中使用 fixed top 0 bottom 0 height 100%)
在那个 div 中我有更多 2 个 div - 一个用于标题,一个用于内容
标题 div 的高度为 65px,我希望内容 div 为左窗口的 100% (100% - 65px) - 当我只提供 100% 时,它会变成 100%,但它会“超出”窗口, 因为 65px 标题 div
如何使内容 div 100% - 65px?
我怎样才能 100% 考虑标题部分...?
最佳答案
在评论中讨论了您的问题后,在您的情况下解决此问题的最佳方法是绝对定位内容元素 65px
从顶部开始,例如:
.content{
position:absolute;
top: 65px;
bottom: 0;
}
但是,如果您不必支持旧版浏览器(IE 8),您也可以使用 CSS 的 calc()
function :
.content{
height: calc(100% - 65px);
}
关于html - 100% div的外部和内部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38364449/