inline-flex 遇上空子层, 会诞生多余的空隙

在做table 时, drag cell 是空的当还没有 hover 时.

原理我不懂, workaround 是 vertical-align: top;

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 10px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .parent {
            font-size: 16px;
            display: inline-flex;
            width: 100%;
            border: 1px solid red;
            /* vertical-align: top; */
        }

        .child {
            height: 20px;
        }
    </style>
</head>

<body>
    <div class="parent">
        <div class="child">

        </div>
    </div>
    <div class="parent">
        <div class="child">

        </div>
    </div>
</body>

</html>
View Code

 

posted @ 2021-02-03 11:25  泉油  阅读(197)  评论(0编辑  收藏  举报
Web Design Johor Bahru Malaysia - Stooges