设置高度100%不工作。 [英] setting height 100% not working.

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

问题描述

出于某种原因,容器的边界不会一直到底部,尽管使其高度为100%。这是我的代码,容器在另一个div中心。提前提醒你

For some reason the container's boundaries wont go all the way to the bottom despite making its height 100%.Here is my code, the container is under another div center.Thank you in advance

Html

<div id="center">
<div class="container" >
 </div>
 </div>

css

 #center {  
 float:left;
 width:20%;
 margin-top:10px;
 height:100%;
  }
 .container{
  margin-top:3px;   
  height:100%;  
  border:2px solid #dedede; 
  width:600px;
   }


推荐答案

body, html{
   height: 98%;
   padding: 0;
}

使用高度进行游戏以消除由边距引起的垂直滚动条

Play around with the height to eliminate the vertical scroll-bars caused by margins and borders on the elements contained within.

http://jsfiddle.net/4JgA4 / 1 /

编辑

100%,并减少主要元素的高度,以消除垂直滚动条。

Otherwise, make it 100% and reduce the height of the main element inside to eliminate vertical scroll-bars.

body, html {
 height: 100%;
 padding: 0;
}

#center {  
 float:left;
 width:20%;
 margin-top:10px;
 height:90%;
}

.container {
  margin-top:3px;   
  height:100%;  
  border:2px solid #dedede; 
  width:600px;
}

http://jsfiddle.net/4JgA4/3/

这篇关于设置高度100%不工作。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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