E
E
Ekaterina Ivasenko2020-04-27 22:32:54
css
Ekaterina Ivasenko, 2020-04-27 22:32:54

The block of logos does not adapt to the phone, why?

The problem is this, I have 8 svg logos, I use bootstrap 4 and everything is in one line (and the line is in the container, and it is in the section, that is, everything seems to be according to the rules)
On the desktop they are:
3 3 3 3
3 3 3 3
On the tablet like this:
4 4 4
4 4 4
And on the phone they should:
6 6
6 6
But it doesn’t work out to adapt to the xs-resolution!
I twisted the code as much as I could, the solution is still not found :(

The code itself for example:

<div class="container">
  <div class="row">
    <div class="col-lg-3 col-md-4 col-sm-4 col-xs-6">
        <div class="logo1"></div>
      </div>
      <div class="col-lg-3 col-md-4 col-sm-4 col-xs-6">
        <div class="logo2"></div>
      </div>
       /*и так же ещё 3 раза; logo(3,4,5,....)*/
  </div>
</div>

.logo1{
  background: url(../image.svg) no-repeat center;
    height: 40px;
    width: 120px;
}
.logo2{
/*другой юрл*/
}


These are screenshots of how it breaks on the phone:
For computers 5ea7300d7a083388461240.png
For tablets 5ea73029af050216833139.png
For phones 5ea73034f30ea622039310.png

The same problem is elsewhere, and the elements on the phone also do not adapt

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2020-04-27
@katushell

Bootstrap doesn't have XS, that's the default. Plus, it makes no sense to specify col-md-4 and col-sm-4, Bootstrap is processed from a smaller resolution to a larger one, so the rules there are not "From and TO", but only "from".
i.e.
.col- <576px
.col-sm- ≥576px
.col-md- ≥768px
.col-lg- ≥992px
.col-xl- ≥1200px
and since in CSS if there are multiple rules for one component, those that apply written last, then .col-sm- will override .col-, .col-md- will override .col-sm- and so on
, fix it, and unsubscribe
<div class=" col-6 col-sm-4 col-lg-3">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question