首页 > 其他 > 详细

display: table; 100%的宽度

时间:2017-05-26 09:15:29      阅读:483      评论:0      收藏:0      [点我收藏+]

技术分享

 

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .box1 {
            display: table;
        }
        .box2 {
            display: table-cell;
            border: 1px solid #000;
        }
        .box3 {
            width: 1%;
            display: table-cell;
            background-color: red;
        }
        /*
            box3 = 1%
            得出
            box2 = 99%

            box3 = 32px
            box2 = 32 * 99 = 3168
            body 1366
            得出
            box2 = body - box3 = 1366 - 32 = 1334
         */
    </style>
</head>
<body>
    <div class="box1">
        <div class="box2">box2</div>
        <div class="box3">box3</div>
    </div>
</body>
</html>

 

display: table; 100%的宽度

原文:http://www.cnblogs.com/jzm17173/p/6906846.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!