下面这个css 保证背景图填充满容器,并且是拉伸
.bg{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #eee; background-size: 100% 100%; background-attachment: fixed; background-image: url(./img/1.jpg); }
两列布局
.left{ float: left; width: 200px; height: 300px; background-color: #ccc; } .auto-right{ margin-left: 200px; height: 300px; background-color: #198610; } <div> <div class="left"></div> <div class="auto-right"></div> </div>
三列布局
#herder{ height:50px; background:blue; } #main{ width:400px; position:relative; } #main .main-left{ width:100px; height:800px; background:red; position:absolute; left:0; top:0; } #main .main-center{ height:800px; background:lightgreen; margin:0 100px 0 100px; } #main .main-right{ width:100px; height:800px; background:pink; position:absolute; right:0; top:0; } #footer{ height:50px; background:gray; } <div id="herder">页头</div> <div id="main"> <div class="main-left">
左列
</div> <div class="main-center">
设计网页的第一步就是设计版面布局,搭建网站结构,网页排版的合理性,在一定程度上也影响着网站整体的布局以及后期的优化。
一个好的网站形象能更容易地吸引用户、留住用户。因此,网站首页第一屏的排版非常重要,很多时候能决定用户的去与留。
</div>
<div class="main-right">右列</div> </div> <div id="footer">页脚</div>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。