dimanche 14 avril 2019

gap between two divs when one has background-image

When I set background-image to one of the div and set the background-size as contain, there will be gap between two divs.

enter image description here

the code is below:

<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>

How to remove the gap?




Aucun commentaire:

Enregistrer un commentaire