当两个div之间有背景图像时的距离

时间:2019-04-15 03:08:23

标签: html css

当我将background-image设置为一个div并将background-size设置为contain时,两个div之间会有间隙。

enter image description here

代码如下:

<head>
    <style>
        .header {
            height: 50px;
            background: url('https://xxx.png') no-repeat;
            background-size: contain;
        }
        .footer {
            height: 30px;
        }
    </style>

</head>
<body>
    <div class="container">
        <div class="header">
        </div>
        <div class="footer">
        </div>
    </div>
</body>

如何消除差距?

0 个答案:

没有答案
相关问题