运用flex布局写下的东西

                   

<!doctype html>
<html lang="zh-cn">
  <head>
    <meta charset="UTF-8">
    <title>携程网</title>
    <!-- <link rel="stylesheet" href="css/normalize.css"> -->
    <link rel="stylesheet" href="rest.css">
    <style>
      a {
        color: black;
        text-decoration: none;
      }

      html,
      body {
        height: 100%;
      }

      div {
        box-sizing: border-box;
      }

      .flex {
        display: flex;
      }

      .flex-center {
        justify-content: center;
        align-items: center;
      }

      .flex-column {
        flex-direction: column;
      }

      .container {
        min-width: 540px;
        max-width: 1200px;
        width: 80%;
        border: 1px solid #ccc;
      }

      .header img {
        width: 100%;
        height: auto;
      }
      /* container部分 */
      /* 大类 */
      .main-content {
        padding: 4px; 
      }

      .con-row {
        border-radius: 4px;
        overflow: hidden;
      }

      .con-row .con-classify,
      .con-row .con-items {
        height: 120px;
        background-color: #FF6A7B;
        flex: 1;
      }
      
      .con-row .con-list a {
        line-height: 60px;
        text-align: center;
      }

      .spacing-left {
        border-left: 1px solid #fff;
      }

      .spacing-right {
        border-right: 1px solid #fff;
      }

      .spacing-bottom {
        border-bottom: 1px solid #fff;
      }

      .spacing-top {
        border-top: 1px solid #fff;
      }

      .spacing-b2 {
        border-bottom: 2px solid #fff;
      }

      .icon {
        background: url(img/ctrip.png) no-repeat;
        background-size: 104px;
      }

      .icon-hotel {
        width: 44px;
        height: 44px;
        background-position: 0 -127px;
      }
    </style>
  </head>
  <body class="flex flex-center">
    <div class="container flex-column flex">
      <div class="header">
        <img src="img/banner.jpg" width="1536" height="307" alt="!">
      </div>
      <!-- 下面的表格背景 main-content-->
      <div class="main-content flex flex-column">
        <!-- 一行  con-row-->
        <div class="con-row flex">
          <!-- 最左边的类 con-classify-->
          <div class="con-classify flex flex-center spacing-b2">
            <a class="flex flex-center flex-column" href="#">
              <span>酒店</span>
              <span class="icon icon-hotel"></span>
            </a>
          </div>
          <!-- 上下结构,设置direction为column | con-items | con-list-->
          <div class="con-items flex flex-column con-list spacing-left spacing-b2">
            <a href="#" class="spacing-bottom">海外酒店</a>
            <a href="#" class="spacing-bottom">特价酒店</a>
          </div>
          <div class="con-items flex flex-column con-list spacing-left spacing-b2">
            <a href="#" class="spacing-bottom">团购</a>
            <a href="#" class="spacing-bottom">同福客栈</a>
          </div>
        </div>
        <div class="con-row flex">
          <!-- 最左边的类 con-classify-->
          <div class="con-classify flex flex-center spacing-b2 ">
            <a class="flex flex-center flex-column" href="#">
              <span>酒店</span>
              <span class="icon icon-hotel"></span>
            </a>
          </div>
          <!-- 上下结构,设置direction为column | con-items | con-list-->
          <div class="con-items flex flex-column con-list spacing-left spacing-b2">
            <a href="#" class="spacing-bottom">海外酒店</a>
            <a href="#" class="spacing-bottom">特价酒店</a>
          </div>
          <div class="con-items flex flex-column con-list spacing-left spacing-b2">
            <a href="#" class="spacing-bottom">团购</a>
            <a href="#" class="spacing-bottom">同福客栈</a>
          </div>
        </div>
        <div class="con-row flex">
          <!-- 最左边的类 con-classify-->
          <div class="con-classify flex flex-center spacing-b2">
            <a class="flex flex-center flex-column" href="#">
              <span>酒店</span>
              <span class="icon icon-hotel"></span>
            </a>
          </div>
          <!-- 上下结构,设置direction为column | con-items | con-list-->
          <div class="con-items flex flex-column con-list spacing-left spacing-b2">
            <a href="#" class="spacing-bottom">海外酒店</a>
            <a href="#" class="spacing-bottom">特价酒店</a>
          </div>
          <div class="con-items flex flex-column con-list spacing-left spacing-b2">
            <a href="#" class="spacing-bottom">团购</a>
            <a href="#">同福客栈</a>
          </div>
        </div>
        <div class="con-row flex">
          <!-- 最左边的类 con-classify-->
          <div class="con-classify flex flex-center spacing-b2">
            <a class="flex flex-center flex-column" href="#">
              <span>酒店</span>
              <span class="icon icon-hotel"></span>
            </a>
          </div>
          <!-- 上下结构,设置direction为column | con-items | con-list-->
          <div class="con-items flex flex-column con-list spacing-left spacing-b2">
            <a href="#" class="spacing-bottom">海外酒店</a>
            <a href="#" class="spacing-bottom">特价酒店</a>
          </div>
          <div class="con-items flex flex-column con-list spacing-left spacing-b2">
            <a href="#" class="spacing-bottom">团购</a>
            <a href="#" class="spacing-bottom">同福客栈</a>
          </div>
        </div>
    </div>
  </body>
</html>

     

<!doctype html>
<html lang="zh-cn">
  <head>
    <meta charset="UTF-8">
    <title>淘宝</title>
    <link rel="stylesheet" href="rest.css">
    <style>
      
      @font-face {
      font-family: 'iconfont';
      src: url('font/iconfont.eot');
      src: url('font/iconfont.eot?#iefix') format('embedded-opentype'),
           url('font/iconfont.woff2') format('woff2'),
           url('font/iconfont.woff') format('woff'),
           url('font/iconfont.ttf') format('truetype'),
           url('font/iconfont.svg#iconfont') format('svg');
      }

      .iconfont {
        font-family: "iconfont" !important;
        font-size: 16px;
        font-style: normal;
      }

      html,
      body {
        height: 100%;
      }

      .flex {
        display: flex;
      }

      .flex-center {
        justify-content: center;
        align-items: center;
      }

      .flex-column {
        flex-direction: column;
      }

      .just-between {
        justify-content: space-between;
      }

      .container ul {
        list-style: none;
        justify-content: space-between;
        border: 1px solid #ccc;
        padding: 8px 8px 0;
      }

      .flex-wrap {
        flex-wrap: wrap;
      }

      .container {
        box-sizing: border-box;
        min-width: 680px;
        max-width: 1200px;
        width: 80%; 
      }

      .container ul li {
        position: relative;
        box-sizing: border-box;
        width: 22%;
        margin-bottom: 8px;
      }

      .container li img {
        width: 100%;
        height: auto;
      }

      .container .mask {
        position: absolute;
        width: 100%;
        height: 100%;
        transform: scale(0);
        transition: .5s;
        background-color: rgba(0,0,0,.5);
        /* display: none; */
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        margin: auto;
        justify-content: space-around;
      }

      .mask p:nth-child(1) span.iconfont{
        color: red;
        vertical-align: center;
      }

      .container li:hover .mask {
        transform: scale(1);
      }
    </style>
  </head>
  <body class="flex flex-center">
    <div class="container">
      <ul class="flex flex-wrap">
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
        <li>
          <img src="img/taobao/food1.webp" width="230" height="230" alt="!">
          <div class="mask flex flex-column">
            <p class="flex">
              <span class="iconfont">&#xe619;</span>
              【N上新口味】稻香村绿豆糕桂花阿斯顿哈啥事
            </p>
            <p class="flex just-between">
              <span>天猫超市</span>
              <span>北京</span>
            </p>
            <p class="flex just-between">
              <span>¥39.90</span>
              <span>15人付款</span>
            </p>
          </div>
        </li>
      </ul>
    </div>
  </body>
</html>

这是第二个的效果图

 这是第一个的效果图

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值