zoukankan      html  css  js  c++  java
  • 伸缩属性的 grow与 shrink

    <style>
    *{
    padding: 0;
    margin: 0;
    }
    .box{
    900px;
    height: 600px;
    border: 1px solid red;
    margin:0 auto;
    /*设置父容器为盒子:会使每一个子元素自动变成伸缩项
    当子元素的宽度和大于父容器宽度的时候,子元素会自动平均收缩*/
    display: flex;
    /*设置子元素的主轴方向上的排列方式*/
    justify-content: space-around;

    }
    .first{
    200px;
    height: 200px;
    background-color: red;
    /*flow-grow:可以来扩展子元素的宽度:设置当前元素应该占据剩余空间的比例值
    比例值计算 :当前空间的flex-grow/所有兄弟元素的flex-grow的和
    flex-grow的默认是0:说明子元素并不会去占据剩余的空间*/
    flex-grow: 1;

    /*flex-shrink:定义收缩比例,通过设置的值来计算收缩空间
    比例值计算 :当前空间的flex-shrink/所有兄弟元素的flex-shrink的和
    默认值为1*/
    /*flex-shrink: 2;*/

    }
    .second{
    200px;
    height: 200px;
    background-color: green;
    flex-grow: 1;
    }
    .third{
    200px;
    height: 200px;
    background-color: blue;
    flex-grow: 2;
    }
    </style>
    </head>
    <body>
    <div class="box">
    <div class="first">1</div>
    <div class="second">2</div>
    <div class="third">3</div>
    </div>
  • 相关阅读:
    dns解析后ping的居然不是自己的ip
    Ubuntu修改默认使用的bash
    安装 libbpg
    libnccl安装
    安装opencv
    tcpdump使用
    jQuery类操作
    jQuery对象和DOM对象的相互转换
    jQuery入口函数
    什么是外边距重叠?重叠的结果是什么?
  • 原文地址:https://www.cnblogs.com/lujieting/p/10230734.html
Copyright © 2011-2022 走看看