zoukankan      html  css  js  c++  java
  • 5.7 弹性盒子

    弹性盒子
    定义弹性盒子 display:flex
    定义子元素排列方式 flex-diection
    定义子元素换行方式 flxe-wrap
    定义子元素对齐方式
    横向对齐 justify-content
    纵向对齐 align-items

    媒体查询    @media screen and (max-最大宽度)and (min-width:最小宽度)
    line-height与vertical-align
    line-height 主要作为调节文本的垂直对齐方式,通过设置行高的大小
    vertical-align 主要作为调节行内元素(span/img)的垂直对齐方式 top bottom middle text-top text-bottom

    !DOCTYPE html>
    <html>
     <head>
      <meta charset="UTF-8">
      <title></title>
      <style type="text/css">
       #parent{
        800px;
        height: 400px;
        border:1px solid black;
        /*定义父元素为弹性盒子*/
        display:flex;
        /*规定子元素的排列方式*/
        flex-direction: row-reverse;
        /*规定换行方式*/
        flex-wrap: nowrap;
        /*子元素在父元素的横向对齐方式*/
        justify-content: space-between;
        /*子元素在父元素的纵向对齐方式*/
        align-items:stretch ;
        }
        .children{
         width :170px;
         height: 180px;
         border: 1px solid red;
         float:left ;
         flex: 1;
         align-self: flex-start;
        }
        .children1{border: 1px solid red;
        flex:3;
        order: 0;}
      </style>
     </head>
     <body>
      <div id="parent">
      <div class="children">1</div>
      <div class="children">2</div>
      <div class="children">3</div>
      <div class="children">4</div>
      <div class="children">5</div>
      <div class="children">6</div>
      <div class="children1">7</div>
      <div class="children">8</div>
      
      </div>
      
      
      
      
     </body>
    </html>
  • 相关阅读:
    python3.4 + pycharm 环境安装 + pycharm使用
    ddt源码修改:HtmlTestRunner报告依据接口名显示用例名字
    re模块
    LeetCode Weekly Contest 12
    求解强连通分量
    几道题-找规律-记录并查找
    欧几里德算法
    树上二分
    几道题-博弈
    随便写一些东西-缩边
  • 原文地址:https://www.cnblogs.com/sunhao1987/p/9004054.html
Copyright © 2011-2022 走看看