flex 子元素属性设置

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <meta http-equiv="X-UA-Compatible" content="IE=edge">    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <title>Document</title></head><style>     /* flex*/     /* section{        display:flex;        width: 21.3333rem;        height: 8rem;        background: pink;        margin: 0 auto;     }     section div:nth-child(1){        width: 2.6667rem;        height: 8rem;        background: red;     }     section div:nth-child(2){        flex: 1;        background: green;     }     section div:nth-child(3){        width: 2.6667rem;        height: 8rem;        background: blue;     } */     /* align-self*/     /* section{        display:flex;        width: 21.3333rem;        height: 8rem;        background: pink;     }     section div{        width: 2.6667rem;        height: 2.6667rem;        background: red;        margin-right: .1333rem;     }     section div:nth-child(3){        align-self:flex-end;     } */          /* order*/     section{        display:flex;        width: 21.3333rem;        height: 8rem;        background: pink;     }     section div{        width: 2.6667rem;        height: 2.6667rem;        background: red;        margin-right: .1333rem;     }     section div:nth-child(3){       order: -1;     }     </style><body>    <!--flex-flow-->    <!-- <section>        <div>1</div>        <div>2</div>        <div>3</div>    </section> -->    <!--align-self-->    <!-- <section>        <div>1</div>        <div>2</div>        <div>3</div>    </section> -->    <!--order-->    <section>        <div>1</div>        <div>2</div>        <div>3</div>    </section>  </body></html><!-- 设置子项分配剩余空间 用flex 来表示占多少份数注意: 数字越大分配越多flex:{    <number>  默认是 0  }设置子项 单个项目与其他项目不一样的对齐方式可以覆盖 aling-items 属性默认值为 auto 表示继承父元素align-items属性如果没有父元素,则等同于stretchalign-self:{    flex-end; }        设置子项位置注意:数字越小越靠前order:{    -1 默认值 0}         -->

     

    posted @   前端搬运工bug  阅读(214)  评论(0编辑  收藏  举报
    相关博文:
    阅读排行:
    · 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
    · 使用C#创建一个MCP客户端
    · ollama系列1:轻松3步本地部署deepseek,普通电脑可用
    · 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
    · 按钮权限的设计及实现
    点击右上角即可分享
    微信分享提示