0

I am trying to break the following row with 4 images on screens that are equal or less than 800px: https://i.ibb.co/1RmqDN2/1row.jpg

Into 2 rows and 2 columns, So it will look something like this: https://i.ibb.co/DWJp7mM/2row.jpg

I am using media queries to try and achieve it, But I am not finding a solution. I am a coding noob and also on css and would love some help. Here is what I have tried so far:

          @media only screen and (max-width: 800px) {
              .AR_55.ob-strip-layout .ob-dynamic-rec-container /*This is the selector of each column (image and the text below it)
              {
                  width:25%;
                  float:left;
              }
          } 

This is the closest I got:

          @media only screen and (max-width: 800px) {
              .AR_55.ob-strip-layout .ob-dynamic-rec-container /*This is the selector of each column (image and the text below it)
              {
                  width:45%;
                  float:left;
              }
          } 

It breaked to 2 columns and 2 rows, But the alignment was bad and I couldn't fix it.

Any ideas? Happy to provide more info if needed. Thanks!

yoavm7
  • 13
  • 3

2 Answers2

0

To achieve perfect alignment, you can have these divs as columns in a table. Below links details how you can split table columns into 2 different rows for smaller screens- Split Table Row(s) for smaller screens

0

Using your method, the following should work:

.AR_55.ob-strip-layout .ob-dynamic-rec-container {
  width: 25%;
  float: left;
}

@media only screen and (min-width: 800px) {
  .AR_55.ob-strip-layout .ob-dynamic-rec-container {
    width: 50%;
    float: left;
  }
}

I also used min-width within the media query, my preference read more about it here

Also, feel free to update your question with your code shared with us in a codepen or similar.

Adam Gonzales
  • 829
  • 7
  • 11