[英]100% Height not working for Firefox or Chrome
I have an seemingly odd CSS issue that only seems to be coming up in Chrome and Firefox (IE11 is playing ball). 我有一个看似奇怪的CSS问题,似乎仅在Chrome和Firefox中出现(IE11正在发挥作用)。
The design calls for a sidebar and main content. 设计需要侧边栏和主要内容。 The sidebar has to always be 100% of the screen but also extend with the content, should the content scroll down.
边栏必须始终是屏幕的100%,而且还应随内容一起扩展(如果内容向下滚动)。 The site uses bootstrap 3.
该站点使用引导程序3。
When the content is less than a screen high, it works fine in IE and Chrome, but not FF. 当内容小于屏幕高时,它在IE和Chrome中可以正常工作,但在FF中不能正常工作。
When the content is more than a screen high, it seems to lose height completely in Chrome and FF. 当内容超过屏幕高度时,Chrome和FF似乎完全失去了高度。
I am using: 我在用:
JSFiddle: http://jsfiddle.net/eek030pu/ JSFiddle: http : //jsfiddle.net/eek030pu/
JSFiddle Fullscreen: https://jsfiddle.net/eek030pu/embedded/result/ JSFiddle全屏显示: https ://jsfiddle.net/eek030pu/embedded/result/
HTML HTML
<div class="container">
<div class="row">
<div class="col-lg-12">
<nav class="navbar navbar-default">
<h4>Header</h4>
</nav>
</div>
</div>
</div>
<div class="container full-height">
<div class="row full-height">
<div class="col-lg-3 full-height">
<div id="main-menu" class="full-height">
<h4>Sidebar</h4>
</div>
</div>
<div class="col-lg-9 content">
<form method="post" action="" id="ctl00" autocomplete="off">
<div>
<h1>Content</h1>
<h1>Content</h1>
<!-- copy paste to cause scrolling -->
</div>
</form>
</div>
</div>
</div>
CSS CSS
html {
position: relative;
height: 100%;
min-height: 100%;
}
body {
height: 100%;
min-height: 100%;
display: table;
width: 100%;
table-layout: fixed;
}
.full-height {
min-height: 100%;
height: 100%;
}
#main-menu {
background-color: red;
}
Any ideas on what I'm doing wrong or where I should be looking? 对我做错了什么或应该去哪里有什么想法?
Try this! 尝试这个!
.full-height {
width: auto;
height: auto;
padding: 0px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.