Y
Y
yoyoyoyoyoyoyoyoyoyoyoyoyo2021-04-20 17:44:50
css
yoyoyoyoyoyoyoyoyoyoyoyoyo, 2021-04-20 17:44:50

How to make adaptive tiles from images?

Good afternoon. I can't make adaptive blocks with images in any way. I'm using bootstrap, but it still doesn't work. It is required to make the second image from the first one, at the same time, so that the picture of any size adjusts to the specified dimensions.

<div class="container">
<div class="row row-cols-2">
    <div class="col img-responsive left-banner"><a href="#">
            <img src="https://i.ibb.co/VgjY5NT/test.jpg" alt="#" title="#" class="banner-left-img img-responsive">
        </a></div>
    <div class="col">
    <div class="col top-banner img-responsive"><a href="#">
            <img src="https://i.ibb.co/VgjY5NT/test.jpg" alt="#" title="#" class="banner-top-img img-responsive">
        </a></div>
    <div class="col bottom-banner img-responsive"><a href="#">
            <img src="https://i.ibb.co/VgjY5NT/test.jpg" alt="#" title="#" class="banner-bottom-img img-responsive">
        </a></div>
    </div>
  </div>
</div>

607ee8c24792e291138116.jpeg
607ee8c9359b5485499012.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Steppp, 2021-04-20
@yoyoyoyoyoyoyoyoyoyoyoyoyo

Grids are the most convenient!

.row .row-cols-2 {
    display: grid;
    grid-template:
      "a b"
      "a c";
}

.img-responsive{ grid-area: a;}
.top-banner{ grid-area: b;}
.bottom-banner{ grid-area: b;}

@media (max-width: 700px) {
  .row .row-cols-2 {
    display: grid;
    grid-template:
      "a a"
      "b c";
  }
}

E
Elena Fire, 2021-04-20
@BormotunJedy

Flex - because it works on all browsers without exception, even on IE

.row.row-cols-2 {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.col {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
}
@media (max-width: 700px) {
.col {flex-direction: row; flex-wrap: wrap;}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question