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

CORE/COLUMNS fix margins on med screens, and odd numbers of cols #12408

Closed
wants to merge 2 commits into from

Conversation

drdogbot7
Copy link

@drdogbot7 drdogbot7 commented Nov 29, 2018

Background

There should be 3 breakpoints:

Mobile: less than 600px
all columns full width and stacked. No margins.

Small: 600px - 782px
columns wrap in rows of 2. Margins on the inside.

Medium: bigger than 782px
all columns fit in one row. Margins on the inside.

PROBLEMS!

PROBLEM 1
Columns don't wrap properly at Small breakpoint

image

SOLUTION

  • move not selectors to Medium breakpoint
  • adjust flex-basis to account for margins using calc()

PROBLEM 2
At the Medium breakpoint, when there is an odd number of columns, and extra margin is added to the last item.

image

SOLUTION

  • reset odd and even selectors to initial at the Medium breakpoint

How has this been tested?

tested in local wordpress docker env, codepen.

ORIG:
https://codepen.io/drdogbot7/pen/NEOQPQ

FIX:
https://codepen.io/drdogbot7/pen/GwYVNz

Types of changes

Only css affecting core/columns.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

Columns were broken b/w the small and medium breakpoints, and when there are an odd number of columns. This fixes those issues.

orig: https://codepen.io/drdogbot7/pen/NEOQPQ
Fix: https://codepen.io/drdogbot7/pen/GwYVNz
@drdogbot7
Copy link
Author

updated to fix formatting, add additional explanatory comments.

@drdogbot7 drdogbot7 changed the title fix margins on med screens, and odd numbers of cols CORE/COLUMNS fix margins on med screens, and odd numbers of cols Dec 11, 2018
@drdogbot7 drdogbot7 closed this Dec 12, 2018
@IvanPr
Copy link

IvanPr commented Feb 22, 2019

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

@drdogbot7
Copy link
Author

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

I believe the fix (not this PR) is going to be in 5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants