我怎样才能使一个div的80%的大小的网页? [英] How can I make a div 80% the size of the page?
本文介绍了我怎样才能使一个div的80%的大小的网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让一个页面容器div的顶边距为10%,底边距为10%。我怎样才能让div占用页面的剩余80%,所有的时间(无论它是否有内容)? 解决方案
<!DOCTYPE html>
< html>
< head>
< style type =text / css>
div {
position:absolute;
身高:80%;
宽度:80%;
top:10%;还剩
:10%;
背景颜色:#FFCC00;
}
< / style>
< / head>
< body>
< div>
这应该证明我的观点。
< / div>
< / body>
< / html>
I'd like to make a page container div have a top margin of 10% and bottom margin of 10%. How can I make the div take the remaining 80% of the page, all the time ( no matter if it has content or not )?
解决方案
This should work:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
div {
position: absolute;
height: 80%;
width: 80%;
top: 10%;
left: 10%;
background-color: #FFCC00;
}
</style>
</head>
<body>
<div>
This should prove my point.
</div>
</body>
</html>
这篇关于我怎样才能使一个div的80%的大小的网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文