Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #613004

    pylon
    Participant

    I have four columns in a row within a section on homepage here. Each column contains an image and sub-title (see first screen grab)

    When this is resized down and breaches the mobile media query size, it reflows to a single column, which is excessive.

    I’d like it to resize so that I get two ‘rows’ of two columns, rather than 4 rows of 1 column. I’m using cornerstone so how would I achieve this?

    #613052

    Paul R
    Moderator

    Hi,

    Thanks for writing in!

    To achieve that, you can add this under Custom > CSS in the Customizer.

    
    @media (max-width: 767px) {
    body #housescores .x-column.x-sm, 
    body #accreditations .x-column.x-sm {
        width:44%
        display:inline-block;
    }
    
    body #housescores,
    body #accreditations {
       text-align:center;
    }
    
    }
    
    

    Hope that helps.

    #614777

    pylon
    Participant

    Hmmmm. Doesn’t appear to be working at >767px.

    Have you assumed i’ve created the columns in a certain way or did you test that css live at your end?

    #614793

    Thai
    Moderator

    Hi There,

    Upon checking your website, I can see that it’s under construction.

    In this case, would you mind providing us with your admin account so we can take a closer look?

    Don’t forget to select Set as a private reply. This ensures your information is only visible to our staff.

    Thanks.

    #616654

    pylon
    Participant

    Sorry! It’s live now!

    #616832

    Jade
    Moderator

    Hi there,

    My apologies as I left out a closing ; to one line of CSS in the previous code given, that’s why it does not appear to working. Kindly use this code instead:

    @media (max-width: 767px) {
        
        body #housescores .x-column.x-sm, 
        body #accreditations .x-column.x-sm {
            width: 44%;
            display: inline-block;
        }
    
        body #housescores,
        body #accreditations {
            text-align: center;
        }
    
    }
    
    /* Shows the blocks in 1 row in smaller screens - remove if you don't need this */
    @media (max-width: 380px) {
    
        body #housescores .x-column.x-sm, 
        body #accreditations .x-column.x-sm {
            width: 98%;
            display: inline-block;
        }
    
    }

    I have tested this code and the current view collapses from 4 columns to 1 column at screen width of 767px and below so we have to define the CSS to set the row to fit 2 blocks in 1 row. The block of CSS at the bottom part is for smaller screen devices to show the boxes individually in each row so they do not show to close to each other. If you want to show them into 2 rows all throughout, you can removed the CSS block for 380px and below devices.

    Hope this helps.