zoukankan      html  css  js  c++  java
  • 弹性盒模型

    1.display: -webkit-box;的应用

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
            .box{
                border: 10px solid #000;
                height: 100px;
                padding: 10px;
                /*display: -webkit-box;*/
            }
            .box div{
                height: 100px;
                width: 100px;
                background: red;
                border: 1px solid #fff;
            }
        </style>
    </head>
    <body>
        <div class="box">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
        </div>
    </body>
    </html>

    运行为:

    加上display: -webkit-box后,运行为:

    2.改变box的排序顺序

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
            .box{
                border: 10px solid #000;
                height: 100px;
                padding: 10px;
                font-size: 20px;
                display: -webkit-bo
            }
            .box div{
                height: 100px;
                width: 100px;
                background: red;
                border: 1px solid #fff;
            }
        </style>
    </head>
    <body>
        <div class="box">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
        </div>
    </body>
    </html>

    运行结果为:

    3.任意排列box的位置

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
            .box{
                border: 10px solid #000;
                height: 100px;
                padding: 10px;
                font-size: 20px;
                display: -webkit-box;
                -webkit-box-direction:reverse;/*改变box的排序顺序*/
            }
            .box div{
                height: 100px;
                width: 100px;
                background: red;
                border: 1px solid #fff;
            }
            .box div:nth-of-type(1){-webkit-box-ordinal-group:2;}
            .box div:nth-of-type(2){-webkit-box-ordinal-group:3;}
            .box div:nth-of-type(3){-webkit-box-ordinal-group:6;}
            .box div:nth-of-type(4){-webkit-box-ordinal-group:1;}
            .box div:nth-of-type(5){-webkit-box-ordinal-group:4;}
            .box div:nth-of-type(6){-webkit-box-ordinal-group:5;}
        </style>
    </head>
    <body>
        <div class="box">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
        </div>
    </body>
    </html>

    运行结果为:

  • 相关阅读:
    好久没有上来,发布几个日志类
    这些天很忙,写一个类似防火墙的东西在WINSOCK2 SPI上做DLL,终于把问题解决了,现提供完整C++项目下载
    Flask学习之搭建环境
    年底总结前序
    3月13日的合照一张
    我也是个张三
    读《广州的一场春梦》有感
    四期合照,纪念小杨离开
    深夜的伤感
    随感,未写先累
  • 原文地址:https://www.cnblogs.com/pmlyc/p/8473590.html
Copyright © 2011-2022 走看看