Closed wheresrhys closed 9 years ago
I think that makes sense - distinguish between larger-screened handsets and older, smaller ones.
I just had a few thoughts about how we could do breakpoints / layouts in a mobile-first fashion. See below what I came up with.
S
layout would start kicking in at 370pxM
layout kicks in at 610pxAlso, I'd like to base the layout sizes on round column widths because it makes it easier to provide a robust fallback for older browsers when width is in round values (otherwise IE will have rounding errors and that can cause layout issues):
S: 370px, // 20px columns
M: 610px, // 40px columns
L: 850px, // 60px columns
XL: 1090px // 80px columns
Do you think that would work?
/// Number of columns
///
/// @type Number (unitless)
$o-grid-columns: 12 !default;
/// Gutter size in pixels
///
/// @type Number
$o-grid-gutter: 10px !default;
/// Minimum width in pixels
///
/// @type Number
$o-grid-min-width: 240px !default;
/// Maximum width in pixels
///
/// @type Number
$o-grid-max-width: 1330px !default;
/// Layouts
///
/// @type Map
$o-grid-layouts: (
S: 370px, // 20px columns
M: 610px, // 40px columns
L: 850px, // 60px columns
XL: 1090px // 80px columns
) !default;
Breakpoints are now:
$o-grid-layouts: (
S: _oGridWidth($column-width: 30px), // 490px
M: _oGridWidth($column-width: 50px), // 730px
L: _oGridWidth($column-width: 70px), // 970px
XL: _oGridWidth($column-width: 90px) // 1210px
) !default;
In a sense, XS is the default breakpoint (240-490px).
Just been looking at this again. Can S kick in at the smaller value suggested initially of 370px? There is a big difference between devices of width 240px (which I think is still the minimum width grid will go to?) and 490px - to not offer a breakpoint inbetween leaves this issue barely addressed. @simonwilliamsFT @kaelig
PS - sorry for raising this so late in the day, only just picked up on the breakpoint change
@wheresrhys Thanks for looking at it. The range of things than can happen in between 240px and 490px is endless, and requires some fine-tuning to be done well. The breakpoints are "global layout sizes", which doesn't exclude more a granular approach with tweakpoints in between two breakpoints.
For argument's sake, let's say there is an element that needs to be floated when the viewport reaches 337px wide. It would be possible to use Sass MQ mq(337px)
or oGridRespondTo(337px)
(or even a simple media query, but I'd recommend to stick with the mixins mq
and oGridRespondTo
).
.my-element {
// default rules
@include mq(337px) {
// tweaks
@include oGridColumn(1/2);
}
}
Feel free to have a look at the "Final Thoughts" of this article: http://www.sitepoint.com/breakpoints-tweakpoints-sass/ where @hugogiraudel explains how to create component-specific and project-specific media query wrappers for Sass MQ.
I agree that fine-tuning can, and should, be done on a product level, but I still think it would be more useful for the difference between breakpoints to be smaller between say XS and S compared to between L and XL.... a mildly logarithmic progression would be better I think.
At present the difference between each pair of adjacent breakpoints is roughly 240px, but this makes the implicit assumption that adding 240px to the width has a constant impact/utility regardless of what the original width was. It fails to acknowledge that adding 240px to 240px doubles the width, whereas adding 240px to 970px only adds 1/5th. It's difficult to quantify/argue for but it is important
It's o-grid's job to standardise on useful default breakpoints and I don't think the S breakpoint is as useful as it could be. We may well end up hacking in a smaller breakpoint for use across next. See below - 2 cols would work at the second width but not at the first.
I see what you mean, could it work for you to add a breakpoint, using variable $o-grid-layouts
?
// Add the "Next Small" tweakpoint
$o-grid-layouts: map-merge((NS: 370px), $o-grid-layouts);
But why isn't the default S layout up to discussion?
That would work for us yes - what a wonderfully flexible grid you've made!
I still think the constant 240px interval between the default breakpoints isn't optimal for targeting handheld devices though. We could, I presume, overwrite all the breakpoints to whichever values we want?
@AlbertoElias well said comrade :)
I agree that between XS and S breakpoints, there is a lot of room for layout changes.
Here is a breakdown of my views on the new breakpoints and why they exist:
We make sure the content is readable but let's be honest, it won't be very usable, which is probably fine for now, as watches with a browsers and really old phones aren't a concern.
Probably the layout that should get the less love and focus because I assume this is the smaller part of our audience.
Serves easily two big and very different parts of our audience:
Most computer screens today, we might add another breakpoint after that one later, but for now it's already a pretty big scope for designers to think about.
Does that help? I think a lack of communication on my side led to a misunderstanding, and hopefully this breakdown helps conveying this message: feel free to add tweakpoints!
As discussed last week, a product can add their own layouts and tweak the default breakpoints.
The Next FT is experimenting with a XS breakpoint, which might become part of the default set later on. Closing this, as it's no longer an issue.
At 600px it's still feasible to have plenty of UI elements which take up half the width (e.g., next article cards), whereas at 240px it becomes very impractical. I think o-grid should give developers a built in breakpoint at about 400px to be able to define a layout for very small screens.
@danskinner @kaelig