CSS3 flex弹性步局

时间:2019-09-25 13:26:53   收藏:0   阅读:90

1.Flex容器属性

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Test</title>
    </head>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        ul{
            margin: 20px auto;
            list-style: none;
            width: 500px;
            height: 200px;
            border: 1px solid red;
            /* 设置为flex容器 */
            display: flex;
        }
        ul>li{
            width: 100px;
            height: 100px;
            line-height: 100px;
            text-align: center;
            color:#fff;
            font-size: 30px;
        }
    </style>
    <body>
        <ul>
            <li style="background-color: red">1</li>
            <li style="background-color: green">2</li>
            <li style="background-color: blue">3</li>
            <li style="background-color: pink">4</li>
        </ul>
    </body>
</html>

效果:
技术分享图片

技术分享图片

baseline: 项目的第一行文字的基线对齐
stretch:拉伸,如果项目未设置高度或设为auto,将占满整个容器的高度。
技术分享图片

技术分享图片

原文:https://www.cnblogs.com/OrochiZ-/p/11583880.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!