• I’m using the WordPress columns block to display a list of three services, just like in this example.

    As the page width shrinks (or on a device with a smaller screen), the column block uses flex-wrap: wrap; to wrap the column contents (as in the “wrap” example, here), which looks awkward with three columns on a small screen, because one column just ends up hanging below the others or eventually displays the columns all vertically, instead of horizontally.

    Instead, I’d like to columns to behave so that their contents resize dynamically, all staying in one (horizontal) row, but becoming smaller / shrinking in size as the screen width becomes smaller. What is the correct CSS to modify the columns block to behave in this way?

    Just setting the block to flex-wrap: nowrap; keeps the columns all on one (horizontal) row, but what is the right CSS to make the contents of the column (below) responsively shrink as the screen width is reduced, so they don’t all overlap each other as the screen width shrinks?

    <div class="wp-block-column">
    <div class="wp-block-image">
    <figure class="aligncenter">
    <a href="[link to page]" target="_blank" rel="noopener noreferrer"><img src="[link to image]" class="wp-image-[###]" width="64" height="64">
    </a>
    </figure>
    
    <h3>
    <a href="[link to page]>Service Title
    </a>
    </h3>
    </div>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter hastibe

    (@hastibe)

    Here’s a code pen I put together with the HTML and CSS in question that I’m looking to modify in the way described above.

    Thread Starter hastibe

    (@hastibe)

    One solution here.

    Greetings…

    I have a question. I am very new to this, so bear with me please… Does his code apply to columns I have created,not using a block. Also,do I add this code to the CSS box on the specific page I am working on, or do I add it to my Child’s theme settings section?

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to Set WordPress Column Block to Resize Responsively instead of Wrap’ is closed to new replies.