即使屏幕高度增加,如何使Html布局保持不变?如何根据%改变高度? [英] How Do I Make Html Layout Constant Even If There Is Increase In Height Of The Screen & Also How To Change Height In Terms Of %?
本文介绍了即使屏幕高度增加,如何使Html布局保持不变?如何根据%改变高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<body>
<div class="box">
<div class="innerBox left">
</div>
</div>
<div class="box">
<div class="innerBox center">
</div>
</div>
<div class="box">
<div class="innerBox right">
</div>
</div>
</body>
<style>
.box{
width:100%;
hieght:100%;
display:block;
padding:4px;
clear:both;
}
.innerBox{
width:33%;
height:211px;
background-color:#ccc;
border:1px solid #444;
}
.innerBox.left{
float:left;
}
.innerBox.center{
margin:auto;
}
.innerBox.right{
float:right;
}
</style>
推荐答案
为了使你的身高保持不变,然后为min-height和max-height属性赋予相同的值。
例如:
Hi, To make your height constant then give same value for both min-height and max-height properties.
For Example :
p
{
min-height:100px;
max-height:100px;
}
并根据百分比调整身高,然后再去以下示例
示例:
And to make your height to change based on precentage, then go with the following example
Example :
body {
margin: 0 auto;
height: 100%;
width: 100%;
}
.header {
height: 50%;
width: 100%;
position:absolute;
border: 1px solid red;
box-sizing:border-box;
}
请点击此链接 [ ^ ]供参考。
这篇关于即使屏幕高度增加,如何使Html布局保持不变?如何根据%改变高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文