I'm facing an issue with the layout of a section on my desktop site - when viewed on mobile, the image overlaps everything else. I need the image to be above and the orange box below on mobile.
Desktop
https://i.sstatic.net/Tu05k.jpg
MOBILE https://i.sstatic.net/YThnZ.png
.second-section .box-orange {
background-image: url("/img/fundo2.png");
height: 400px;
color: white;
margin-top: 10%;
margin-bottom: 10%;
}
.second-section .box-orange img {
height: 550px;
margin-top: -10%;
margin-left: 2%;
object-fit: cover;
}
.second-section .box-orange h3 {
font-size: 2.5em;
margin-bottom: 5%;
}
.second-section .box-orange h3 .line {
font-size: 2.5em;
margin-bottom: 5%;
}
.second-section .box-orange p {
font-size: 2.5em;
margin-bottom: 5%;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<section class="second-section">
<div class="container">
<div class="row align-items-center box-orange">
<div class="col-md-6">
<img class="w-100" src="img/campos.png">
</div>
<div class="col-md-6 ml-5 ml-md-0 text-center">
<h3>lorem lorem! <div class="line"></div>
</h3>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eum nulla quod alias odio perspiciatis architecto, possimus, aliquid repellendus totam, quos nihil similique. Laborum eaque ipsa beatae amet sapiente temporibus. Rerum.
</p>
</div>
</div>
</div>
</section>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
I am unsure whether I need to adjust my CSS structure or use some media queries to achieve the desired mobile layout.
The mobile version needs to look like this.
https://i.sstatic.net/Aprfo.png
After applying the media query, this was the result.
@media only screen and (max-width: 800px) {
.second-section img {
height: unset;
margin-left:unset;
}
.textdiv {
margin-left:0px;
}
}