zoukankan      html  css  js  c++  java
  • 【CSS】实现五点布局

    实现五点布局

    在这里插入图片描述

    <div class="box">
      <div class="column">
        <span class="pip"></span>
        <span class="pip"></span>
      </div>
      <div class="column">
        <span class="pip"></span>
      </div>
      <div class="column">
        <span class="pip"></span>
        <span class="pip"></span>
      </div>
    </div>
    
    /* 重点内容 */
    .box{
      display: flex;
      flex-direction: column;
    }
      
    .box .column {
      display: flex;
      justify-content: space-between;
    }
      
    .box .column:nth-of-type(2) {
      justify-content: center;
    }
    
    
    
    body {
      display: flex;
      align-items: center;
      justify-content: center;
      vertical-align: center;
      flex-wrap: wrap;
      align-content: center;
      font-family: 'Open Sans', sans-serif;
      
      background: linear-gradient(top, #222, #333);
    }
    
    .box {
      margin: 16px;
      padding: 4px;
      
      background-color: #e7e7e7;
      width: 104px;
      height: 104px;
      object-fit: contain;
      
      box-shadow:
        inset 0 5px white, 
        inset 0 -5px #bbb,
        inset 5px 0 #d7d7d7, 
        inset -5px 0 #d7d7d7;
      
      border-radius: 10%;
    }
    
    .pip {
      display: block;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      margin: 4px;
    
      background-color: #333;
      box-shadow: inset 0 3px #111, inset 0 -3px #555;
    }
    
    
    
    • 或者换成row弹性,每个元素flex-wrap: wrap; align-content: space-between;,中间的元素align-content: center;
    /* 重点内容 */
        
        .box {
            display: flex;
            flex-direction: row;
        }
        
        .box .column {
            display: flex;
            flex-wrap: wrap;
            align-content: space-between;
        }
        
        .box .column:nth-of-type(2) {
            align-content: center;
        }
        
        body {
            display: flex;
            align-items: center;
            justify-content: center;
            align-content: center;
            background: linear-gradient(top, #222, #333);
        }
    
  • 相关阅读:
    清除微信浏览器缓存
    JS实现HTML标签转义及反转义
    mvc中服务器端、客户端属性验证
    Ajax.ActionLink参数详解
    Ajax.BeginForm参数详解
    AjaxHelper简介
    将博客搬至CSDN
    Sequelize小记
    端口: 查看端口状态
    搭建git服务器
  • 原文地址:https://www.cnblogs.com/SiriusZHT/p/14521323.html
Copyright © 2011-2022 走看看