Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72443

remove body margin on one div

$
0
0

With this design, the divs have a margin on left and on the right that I need to remove but only on .custom-mobile-row not in the rest on the page like if I use

body{
    margin: 0;
}

this is the html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>

    <div class="custom-mobile-row">
        <div class="half-row" id="div1"></div><div class="half-row" id="div2"></div>
    </div>
</body>
</html>

and the css

.custom-mobile-row{
    width: 100%;
}
.half-row{
    width: 50%;
    display: inline-block;
    height: 500px;
    background-size: cover;
    background-position: center;
    vertical-align: top;
}
@media (max-width: 768px) {
    .half-row {
        width: 100%;
    }
}
@media (min-width: 768px) {
    .custom-mobile-row{
        white-space: nowrap;
    }
}
#div1{
    background-image: url("img1.jpg");
}
#div2{
    background-image: url("img2.jpg");
}
body{
    margin: 0;
}

Viewing all articles
Browse latest Browse all 72443

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>