zoukankan      html  css  js  c++  java
  • div水平垂直居中

    水平垂直居中

    效果

    html

        <div class="m-box">
          <div class="m-temp">
            <div class="m-item">fsdafsfasdf</div>
            <div class="m-item">fsdafsfasdf</div>
            <div class="m-item">fsdafsfasdf</div>
          </div>
        </div>

    css

      .m-box{
        background-color: #66fff7;
        height: 300px;
         100%;
        display: flex;
        align-items: center;
      }
      .m-temp{
        background-color: cornflowerblue;
        margin-left: auto;
        margin-right: auto;
      }
      .m-item{
        margin: 10px;
        padding: 10px;
        background-color: white;
        float: left;
      }

    水平居中

    改m-temp如下

    .m-temp{
    background-color: cornflowerblue;
    margin-left: auto;
    margin-right: auto;
    /*margin-top: auto;*/
    margin-bottom: auto;
    }

    垂直居中

    效果

    改m-temp如下

      .m-temp{
        background-color: cornflowerblue;
        /*margin-left: auto;*/
        /*margin-right: auto;*/
        margin-top: auto;
        margin-bottom: auto;
      }
  • 相关阅读:
    css盒子模型 ( 基本针对兼容性问题有点帮助 )
    11.5 Array 数组
    11.5笔记 数组去重
    11.5笔记 函数
    11..2笔记 对象
    11.1笔记
    10.31笔记
    10.31笔记 作用域链
    10.15笔记 js
    10.8补
  • 原文地址:https://www.cnblogs.com/lurenjia1994/p/9597628.html
Copyright © 2011-2022 走看看