Closed callumlocke closed 6 years ago
o-grid is already quite complex, and I'm wary of adding more things to it, specially if it's for hacks. Are there more use cases for it?
When I say "hacks", I don't mean weird CSS hacks, I just mean anything that o-grid can't do. Pretty much any time you want to align something visually with the page grid, but when o-grid doesn't provide a suitable mixin. Sometimes you just need a pixel value.
Example: say you've got a div that's a grid element (data-o-grid-colspan="M: 4"
), and then you want to style the layout of the inner elements inside it... You can't easily nest grids, so you need to do custom styling for that inner layout. If you want your custom measurements to align nicely with the page's grid, you need to be able to get pixel values.
Closing this, as it can be solved with CSS grid for individual products now.
Sometimes I just need to know the pixel width of a given number of columns (eg. to use in some custom hack or calculation). It's hard to get this info.
eg. what is the width of 5 columns (inc. interior gutters) on the
M
layout? Or what is the the full 12-column width on theL
layout? I'd like to add a function for this:(There is the oGridColspan() function, but this returns a percentage, which isn't always usable.)
It could look something like this:
notes:
S
(because only snappy layouts can have a straight answer for "how wide is X columns").Happy to do a PR for this if agreed.