典型页面布局

一般典型的页面布局分为头部header、内容体content、底部footer,头部和footer为通用的,内容content可以放置不同类型的文档内容。

典型的页面html结构如下

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>测试页面</title>
</head>
<body>
  <div class="main">
      <div id="header">头部</div>
      <div id="content">内容区</div>
      <div id="foot">底部</div>
  </div>
</body>
</html>

主要css定义文件如下

 html,body {
            margin: 0;
            padding:0; height: 100%;
        }
        .main {
            min-height:100%;
            height: auto !important;
            height: 100%; /*IE6不识别min-height*/
            position: relative;

        }
        #header {
            padding: 10px;
            height: 50px;
            background-color: #30303B;
            line-height: 66px;
        }
#content {
            position: relative;
            padding-top: 108px;
            width: 1000px;
            margin: 0 auto;
            padding-bottom: 64px;/*等于footer的高度*/
        }
#foot {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 64px;/*脚部的高度*/ background: #6cf;
            clear:both;
        }

 

这样就可以看到一个典型的布局页面了

鉴于目前前端主要使用单页面应用的方式进行开发,采用模块化思维,其实基本原理是一致的。主要是将头部header和底部footer提取成单独的组件即可。样式同样可以借鉴上面书写的样式。

转载于:https://www.cnblogs.com/x123811/p/9964698.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值