col-Md-6 is not falling in mobile

Asked

Viewed 98 times

-1

I have a section that in mobile instead of falling down this overlapping the whole div.

Como esta

It’s supposed to look like this, but the image is getting over everything in mobile.

Como é para ficar

HTML

  <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 lorem lorem lorem <div class="line"></div>
      </h3>
      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Eveniet, esse dolore. Ex voluptatibus ipsum, perferendis alias at necessitatibus minima, sequi facilis odio illum nostrum provident expedita eaque modi animi quasi.
      </p>
    </div>
  </div>
</div>

CSS

.second-section{
.box-orange{
background-image:url('/img/fundo2.png');
height: 400px;
color: white;
margin-top: 10%;
margin-bottom: 10%;
img{
  height: 550px;
  margin-top: -10%;
  margin-left: 2%;
  object-fit: cover;
}
h3{
  font-size: 2.5em;
  margin-bottom: 5%;
  .line{
    width: 80%;
    border: 3px solid #77D3C2;
    position: absolute;
    left: 33%;
    top: 100%;
  }
}

p{
  font-size: 1.4em;
  padding: 0% 10%;
  }
 }
}

In inspecting element does not show the reason it is on top, is getting the same from CSS

Inspecionar elemento


Edit 1

After placing a media rule setting the img to auto she got like this. Edit 1

In inspecting element it looks like height:auto;

  • When you say "mobile", you refer to devices that are not correct tablets?

  • I’m not finding this mistake for nothing :(

  • @THIAGODEBONIS width: -728px

  • @Sam edited the question with the inspect element, but there seems to be nothing wrong.

  • @Sam is SCSS, I forgot to mention.

  • This is because the image has a fixed height of 550px. Place at the end of your CSS a @media Rule: @media screen and (max-width: 767px){&#xA; .second-section img{&#xA; height: auto;&#xA; }&#xA;}&#xA;

  • @Sam sees the Dit.

  • So. There you adjust the properties (height, margins etc) as you want in @media.

  • But I tried to put a min-width: 100%; on . box-Orange, but it didn’t change.

Show 4 more comments

1 answer

-1

Bootstrap grid rules are as follows:

Extra small <576px: Col-1 to Col-12,

Small 540px: Col-Sm-1 to Col-Sm-12,

Medium 768px: Col-Md-1 to Col-Md-12,

Large 992px: Col-lg-1 to Col-lg-12,

Extra Large 1200px: Col-Xl-1 to col-Xl-12,

In SCSS you can use as follows if it is a mobile smaller than 576px use like this: @extend .col-12;.

If it is a mobile larger or equal 576px can use this way: @extend .col-sm-12;.

This follows successively until the other visions, I hope to have helped you and removed your doubts

  • I had already seen these rules, but without success in trying to apply them.

  • Send me the code you want to apply, please, so I understand your question better.

  • If it is image processing Bootstrap has the img-Fluid this class it allows you to resize proportional image by height that reminds me perfectly, ai does not lose quality.

  • All the code with the example of how this should look in the question.

  • I had already added img-Fluid, but nothing changed

  • takes the box-Orange class and puts it in a div around the text, and z-index: 999; in the image and a margin-top:0; in the box-Orange and only determine the size of the box-Orange, see if it solves,

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.