CSS边缘vh无法正常工作

时间:2017-02-23 20:08:19

标签: html css



    #grenze
    {
    	background: green;
    	height: 96vh;
    	width: 96vh;
    }
    
    #baukasten
    {
    	background: white; 
    	height: 86vh; 
    	width: 86vh; 
    	margin: 5vh;
    	border: 1px solid #DDDDDD;  
    	overflow: hidden;
    }

<div id="grenze">
   <div id="baukasten">   
   </div>
</div>
&#13;
&#13;
&#13;

保证金只适用于左边但不是顶部,我尝试使用不同的浏览器,它总是一样的。这可能是什么问题?这是一个错误吗?

修改

我无法在grenze上使用填充,因为

            $( ".dragresize" ).draggable({
                containment: "#grenze"
            });

不会做我需要的事情

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
#grenze {
  background: green;
  height: 96vh;
  width: 96vh;
  padding: 5vh;
  box-sizing: border-box;
}

#baukasten {
  background: white;
  height: 86vh;
  width: 86vh;
  border: 1px solid #DDDDDD;
  overflow: hidden;
}
&#13;
<div id="grenze">
  <div id="baukasten">
  </div>
</div>
&#13;
&#13;
&#13;

&#13;
&#13;
#grenze {
  background: green;
  height: 96vh;
  width: 96vh;
}

#baukasten {
  background: white;
  height: 86vh;
  width: 86vh;
  transform: translate(5vh, 5vh);
  border: 1px solid #DDDDDD;
  overflow: hidden;
}
&#13;
<div id="grenze">
  <div id="baukasten">
  </div>
</div>
&#13;
&#13;
&#13;