zoukankan      html  css  js  c++  java
  • calc

    calc 和flexbox搭配,用来写流式布局非常好;

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>CSS3 Calc</title>
        <style type="text/css" media="screen">
            html{
                font-size:62.5%;
            }
            .wrapper{
                width:100%;
                border:5px solid #f00;
                margin:10px ;
                box-sizing:border-box;
                height:200px;
                clear:both;
            }
            .items{
                height:calc(100% - 40px);
                display:inline-block;
                border:1px solid #f70;
                text-align:center;
            }
    
            .w1 .items{
    
                float:left;
                margin-top:calc( 5 * 4px  );
                border:3px solid #0F16C6;
                width:calc(100% / 3 - 6px)
            }
    
            .w2 .items{
                float:left;
                margin-top:calc(200px - 20px * 9);
                width:calc(100% / 3 - 2px)
            }
    
            .w3 .items{
                float:left;
                width:calc(100% / 3 - (3 * 6px));
                margin:calc(2px * 4 );
            }
    
            .w3 .items:first-child{
                padding:calc(5 * 1rem - 3rem);
                box-sizing:border-box;
            }
    
        </style>
    </head>
    
    <body>
    <div class="wrapper w1">
        <div class="items">margin-top:calc( 5 * 4px  );</div>
        <div class="items">margin-top:calc( 5 * 4px  );</div>
        <div class="items">margin-top:calc( 5 * 4px  );</div>
    </div>
    <div class="wrapper w2">
        <div class="items">margin-top:calc(200px - 20px * 9);</div>
        <div class="items">margin-top:calc(200px - 20px * 9);</div>
        <div class="items">margin-top:calc(200px - 20px * 9);</div>
    </div>
    <div class="wrapper w3">
        <div class="items">calc(100% / 3 - (3 * 6px));<br>margin:calc(2px * 4 );<br>padding:calc(5 * 1rem - 3rem);</div>
        <div class="items">calc(100% / 3 - (3 * 6px));<br>margin:calc(2px * 4 )</div>
        <div class="items">calc(100% / 3 - (3 * 6px));<br>margin:calc(2px * 4 )</div>
    </div>
    </body>
    </html>
  • 相关阅读:
    CentOS 8上安装MySQL 8.0
    centos8安装redis
    virtualbox虚拟机ubuntu18.04网络配置--虚拟机和宿主机互通且联网
    Controller同时接收MultipartFile数据和json数据
    日期转换
    Python的Mysql操作
    Go语言学习笔记十三: Map集合
    Go语言学习笔记十二: 范围(Range)
    Go语言学习笔记十一: 切片(slice)
    Go语言学习笔记十: 结构体
  • 原文地址:https://www.cnblogs.com/wang715100018066/p/6292526.html
Copyright © 2011-2022 走看看