Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid system is not responsive for the columns block #12675

Closed
alextseitlin opened this issue Dec 7, 2018 · 6 comments
Closed

Grid system is not responsive for the columns block #12675

alextseitlin opened this issue Dec 7, 2018 · 6 comments
Labels
[Block] Columns Affects the Columns Block Needs Testing Needs further testing to be confirmed.

Comments

@alextseitlin
Copy link

alextseitlin commented Dec 7, 2018

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.

@designsimply designsimply changed the title Grid system is not responsive Grid system is not responsive for the columns block Dec 7, 2018
@designsimply designsimply added Needs Testing Needs further testing to be confirmed. [Block] Columns Affects the Columns Block labels Dec 7, 2018
@designsimply
Copy link
Member

Possibly related: #12640.

@m-e-h
Copy link
Member

m-e-h commented Dec 7, 2018

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

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

@IvanPr
Copy link

IvanPr commented Feb 22, 2019

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

@youknowriad
Copy link
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?

@IvanPr
Copy link

IvanPr commented Feb 22, 2019

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;
 }
}

@youknowriad
Copy link
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
Labels
[Block] Columns Affects the Columns Block Needs Testing Needs further testing to be confirmed.
Projects
None yet
Development

No branches or pull requests

5 participants