手记

CSS布局——混合布局案例

<!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>
3人推荐
随时随地看视频
慕课网APP