Skip to content

Grid system is not responsive for the columns block #12675

Closed

Description

@alextseitlin

On width 600px the 2 columns fall under each other and create an empty space on the right. But they should fill the whole space. This issue is the same with more than 2 columns.

To Reproduce

  1. Add 2 columns
  2. Make the width little smaller than 600px
    image

Possible fix
wp-block-column is using margins for gaps:
image

Using paddings will fix this issue.

Activity

  1. changed the title [-]Grid system is not responsive[/-] [+]Grid system is not responsive for the columns block[/+] on Dec 7, 2018
  2. added
    Needs Testing
    [Block] Columns
    on Dec 7, 2018
  3. designsimply commented on Dec 7, 2018

    @designsimply
    Member

    Possibly related: #12640.

  4. m-e-h commented on Dec 7, 2018

    @m-e-h
    Member

    Yep, all sort of related I think:
    #12199
    #12640
    #12408

    @drdogbot7 has a couple nice codepens of the issue in #12408

  5. IvanPr commented on Feb 22, 2019

    @IvanPr

    The Wordpress 5.1 is out but this issue still remains...

  6. youknowriad commented on Feb 22, 2019

    @youknowriad
    Contributor

    @IvanPr This kind of comments on multiple issues don't really help. If you want to move things forward, maybe you could take a stab at these?

  7. IvanPr commented on Feb 22, 2019

    @IvanPr

    Sure, here are the CSS rules that solved an issue for me:

    .has-3-columns > .wp-block-column:last-child {
      margin-right: 0;
    }
    
    @media (max-width: 781px) {
    
      .has-2-columns > .wp-block-column,
      .has-3-columns > .wp-block-column,
      .has-4-columns > .wp-block-column {
        flex-basis: calc(50% - 32px);
        flex-grow: 0;
      }
    
      .has-4-columns > .wp-block-column:nth-child(odd) {
        margin-left: 0;
        margin-right: 32px;
      }
    
      .has-4-columns > .wp-block-column:nth-child(even) {
        margin-right: 0;
      }
    
      .has-3-columns {
        flex-flow: row wrap;
      }
    
      .has-3-columns .wp-block-column:first-child {
        flex-basis: 100%;
        margin-right: 0;
      }
    
      .has-3-columns > .wp-block-column:nth-child(even) {
        margin-left: 0;
        margin-right: 32px;
      }
    
      .has-3-columns > .wp-block-column:nth-child(odd) {
        margin-right: 0;
      }
    }
    
    @media (max-width: 599px) {
     .has-2-columns > .wp-block-column,
     .has-3-columns > .wp-block-column,
     .has-4-columns > .wp-block-column {
      flex-basis: 100%;
      margin-left: 0 !important;
      margin-right: 0 !important;
     }
    }
    
  8. youknowriad commented on Aug 22, 2019

    @youknowriad
    Contributor

    This seems fixed in my testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Testing[Block] Columns

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions