继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

CSS布局——混合布局案例

highcker
关注TA
已关注
手记 1
粉丝 2
获赞 7
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title></title>
  <style type="text/css">
    /*此处写代码*/
    body {
        padding: 0;
        margin: 0;
    }

    .container {
        width: 80%;
        height:720px;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        margin: auto;
    }

    .banner {
        width: 100%;
        background: #add8e6;
        height: 480px;
    }

    .banner_l {
        float: left;
        width:50%;
        height:100%;
        background: url("http://climg.mukewang.com/58c0f808000129a303600215.jpg") center center no-repeat;
    }

    .banner_r {
        float: right;
        width: 50%;
        height: 100%;
    }

    .banner_r img {
        position: relative;
        top:50%;
        left: 50%;
        margin-top:-107px;
        margin-left:-180px;
    }

    .footer {
        width: 100%;
        height: 240px;
        background: #ffb6c1;
        display: table;
        text-align: center;
    }

    .footer_l, .footer_m, .footer_r{
        display: table-cell;
        vertical-align: middle;
        height: 240px;
    }

  </style>
</head>
<body>
  <!-- 此处写代码 -->
  <div class="container">
      <div class="banner">
            <div class="banner_l"></div>
            <div class="banner_r">
                <img src="http://climg.mukewang.com/58c0f819000198a703600214.jpg" alt="">
            </div>
      </div>
      <div class="footer">
            <div class="footer_l">
                <img src="http://climg.mukewang.com/58c0f81d0001fe4402000060.jpg" alt=""> 
            </div>
            <div class="footer_m">
                <img src="http://climg.mukewang.com/58c0f8220001dfce02000060.jpg" alt=""> 
            </div>
            <div class="footer_r">
                <img src="http://climg.mukewang.com/58c0f8780001c74602000060.jpg" alt=""> 
            </div>
      </div>
  </div>
</body>
</html>
打开App,阅读手记
3人推荐
发表评论
随时随地看视频慕课网APP