精美而实用的网站,关注web编程技术、网站运营、SEO推广,让您轻松愉快的学习

本文主要跟大家分享全屏自适应布局应该怎么写?青岛星网下面写了一个简单的:div+css全屏自适应布局范例代码给大家参考学习。

div+css全屏自适应布局HTML代码

<div class="g-hd">
</div>
<div class="g-sd">  
</div>
<div class="g-mn">
</div>
<div class="g-ft">
</div>

div+css全屏自适应布局CSS代码

/* 全屏自适应布局  */
html,body{width:100%;height:100%;overflow:hidden;margin:0;}
html{_height:auto;_padding:100px 0 50px;}
.g-hd,.g-sd,.g-mn,.g-ft{position:absolute;left:0;}
.g-hd,.g-ft{width:100%;}
.g-sd,.g-mn{top:100px;bottom:50px;_height:100%;overflow:auto;}
.g-hd{top:0;height:100px;}
.g-sd{width:300px;}
.g-mn{_position:relative;left:300px;right:0;_top:0;_left:0;_margin-left:300px;}
.g-ft{bottom:0;height:50px;}

在线Demo预览

Tags:DIV+CSS HTML CSS 自适应