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

Mobile first grid system #182

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

JazzBrotha
Copy link

I changed the grid system to a mobile-first approach by changing the queries to min-width to avoid display issues on larger screens. I provided Bootstrap 4 breakpoints to fit accordingly. Tested and working.

@JazzBrotha JazzBrotha mentioned this pull request Apr 5, 2017
@picturepan2
Copy link
Owner

@JazzBrotha What issues do you get on larger screens?

@JazzBrotha
Copy link
Author

JazzBrotha commented Apr 10, 2017

Since the col-xl breakpoint is at max-width:1280px the grid structure doesn't keep at larger screens.

@picturepan2
Copy link
Owner

@JazzBrotha You can still use col-[1-12].

@JazzBrotha
Copy link
Author

Yes, but what if I want to have different grid structures of different devices? I can't switch col-[1-12] for different devices, right?

@picturepan2
Copy link
Owner

@JazzBrotha Have you tried something like this col-xs-12 col-sm-6 col-3?

@JazzBrotha
Copy link
Author

Yes, I did. After 1200px it doesn't apply the width of the column span, thus breaking the grid structure.

@picturepan2
Copy link
Owner

@JazzBrotha Can you show me your code?

@JazzBrotha
Copy link
Author

@picturepan2 Sure man.

<div class="columns">
   <div class="column col-xs-12 col-sm-6 col-md-6 col-lg-4 col-xl-3 col-2">
   </div>
 </div>

@picturepan2
Copy link
Owner

@JazzBrotha The column width becomes 25% when the window width is larger than 960px and less than or equal to 1280px. And it becomes 16.66666667% when the window is larger than 1280px. Is it what you need?

@JazzBrotha
Copy link
Author

@picturepan2 No. What if I want the width to become 50% at screens larger than 1280px? I can't just change col-2 to col-6 since I am using the responsive grid system.

@picturepan2
Copy link
Owner

@JazzBrotha I think you can just change col-2 to col-6. In your case, you have already defined every situation width <= 1280px, and col-2 only work when width > 1280px.

@JazzBrotha
Copy link
Author

@picturepan2 Ok. It doesn't work like that for me. The width of the column is stuck at 16.66666667% on all screen resolutions >1280px for col-[1-12], but maybe I am doing something wrong. However, I had a few friends who experienced the same issue hence why I opened the pull request.

@picturepan2
Copy link
Owner

@JazzBrotha No. Maybe it is Spectre's bug. Can you show me more code? Or online example?
I don't merge the Pull Request, because this change is so big that many projects will be impacted.
Thank you.

@JazzBrotha
Copy link
Author

@picturepan2 Of course man. I understand completely. Unfortunately I don't have a live example of the non-working grid, as I changed it for my application to work better on larger screens.

@picturepan2
Copy link
Owner

@JazzBrotha Can you try your app with the Responsive Resizer tool?

@alexandremjacques
Copy link

I can see that @picturepan2 is concerned about the impact of changing the way grids are created. My suggestion is: take @JazzBrotha solution (which solve every problem related to responsiveness) and use it with other class names (instead of col-xx-xx), keeping both solutions at the same time. That way users can keep their site working and, meanwhile, people who needs responsiveness can use the new solution. Eventually, you can deprecate the old solution.

@kosciak9
Copy link

kosciak9 commented Jul 8, 2017

I have similar problem with Grid System and want to +1 the Pull Request. Is the solution proposed by @alexandremjacques considered by you, @picturepan2? :)

@Geczy
Copy link

Geczy commented Aug 31, 2017

Need this as well

@jsmsalt
Copy link

jsmsalt commented Sep 22, 2017

Most grid systems are mobile first, +1 to this.

For example, if I need a column to have 100% of the size in mobile phones and from a medium size only have 50% of size.

In Spectre:
. col-sm-12. col-6

In other frameworks it would be:
. col-sm-12. col-md-6

No need to use. col-6 as a fallback. Because you clearly can't use .col-xl-6, it wouldn't apply to screens that exceed 1280px.

Visibility classes also need to be mobile first. They are currently "visible to this size" or "hidden to this size", unlike most frameworks that specify "visible from this size" and "hidden from this size".

It is a change of perspective that at first is difficult to understand if you are accustomed to modern practices that focus on "mobile first".

@picturepan2
Copy link
Owner

@jsmsalt The idea behind Spectre grid is targeting the specific size range "breakpoint between", not the "breakpoint up". It covers all situations, for example .col-6 applies to all window sizes.

@davestewart davestewart mentioned this pull request Sep 20, 2023
29 tasks
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.

6 participants