Column push and pull for different grids
It would be useful to provide column push and pull classes for all three different grids.
This means that .col-push-* and .col-pull-* only affect the mobile grid and are joined by .col-push-sm-*, .col-pull-sm-* and .col-push-lg-*, .col-pull-lg-* to control the column order differently depending on the grid in use.
Summary: Allow for different column reordering in different grids.
I need this !
If you need this, you're doing it wrong.
This many modifiers for grid layouts is kind of ridiculous and unless someone can come up with a solid case for supporting them, we have no intention of doing that right now.
Here's my use case:
On a wide-screen device, I want columns to be arranged like so: [content A][content B]
On a narrow device, the content should be arranged like: [content B] [content A]
Example # 2 - wide screen: [contentA][contentB][contentC]
Example # 2 - narrow screen: [contentB] [contentA] [contentC]
Is there a way to achieve this type of layout with the current Bootstrap classes??
@andyl http://jsfiddle.net/neJku/5/ ? (for your 2nd example)
@mdo I think that's a reasonable argument, but my question is: what's the point of having them at all if they don't have breakpoint specificity? If they're only meant to work at lg scale then they should only apply to lg scale. Right now they apply to all scales but can only be set to one value.
@cvrebert thanks for the JS fiddle - I extended your example to cover Example 1 and Example 2.
<div class="container show-grid">
<div class='row'>
<div class="col-12 col-sm-4 col-lg-4 col-push-4">
Example 1 / Content B
</div>
<div class="col-12 col-sm-4 col-lg-4 col-pull-4">
Example 1 / Content A
</div>
</div>
<div class='row'>
<div class="col-12 col-sm-3 col-lg-3 col-push-3">
Example 2 / Content B
</div>
<div class="col-12 col-sm-3 col-lg-3 col-pull-3">
Example 2 / Content A
</div>
<div class="col-12 col-sm-3 col-lg-3">
Example 2 / Content C
</div>
</div>
</div>
I agree with @mbleigh. The current classes don't have much value since their effect pretty much the same as reordering the content itself. The real power comes from being able to specify the importance of content depending on the grid. But let's see if the structure mentioned in the comments here suffice for all day needs since they at least allow for different orderings on phones and larger screens.
I agree with @mbleigh, If they only work in one screen size we should drop .col-push and .col-offset altogether.
You'll end up having to write something to make it work on other screen sizes anyway, so better keep it lean.
But I'd prefer dropping offset, and making push/pull work for any screen size.
Rather than adding a bunch of new classes (col-push-lg-, col-push-sm-...) I've submitted a pull request which simple will only apply the pull/push at the proper size. See Pull Request #8977
@plankguy I am not an CSS expert but if you have col-lg and col-sm and for sm you want offset-4 and for lg offset-2. class="col-offset-2 col-offset-4 col-sm-8 col-lg-10" could this work well??
@eratzlaff, I am pretty sure that it won't work. col-offset-2 and col-offset-4 both exist in lg and sm, and the only way to specify "I want this one for the large grid and that one for the small grid" is to have separate classes.
If the only counterargument is that "this many modifiers for grid layouts is kind of ridiculous", I do have a different solution to propose.
Do implement lg-pull, lg-push, sm-pull, and sm-push; but eliminate offset altogether, because it seems to me that you can get the same behavior from push. See this Fiddle.
@eratzlaff Sorry, I didn't make any changes to offsets, the changes were related to push/pull (source ordering). I wrote the wrong classes in my comment - which i've updated.
@plankguy Sorry, I only read your comment. But I thing the same idea can be applied to push and pull. Maybe you want to push-3 on sm and push-3 on lg. I don't have a use case. @jtickle As far I google around (margin-left != left). See this http://stackoverflow.com/a/6419557
@eratzlaff The solution I provided only fixes basic source ordering on single screen size columns (either lg OR sm).
See an example of it here, under title "Source Ordering": http://jsfiddle.net/XRDGQ/3/embedded/result/
@plankguy Here an example way I think you need sm and lg for pull and push
<div class="row">
<div class="col-sm-6 col-lg-4">sm-6 lg-4</div>
<div class="col-sm-6 col-lg-8">sm-6 lg-8</div>
</div>
and you want reorder for sm and lg. For sm you need to push and pull 6 col but for lg push-8 and pull-4
<div class="row">
<div class="col-sm-6 col-lg-4 col-push-sm-6 col-push-lg-8">sm-6 lg-4</div>
<div class="col-sm-6 col-lg-8 col-pull-sm-6 col-pull-lg-4">sm-6 lg-8</div>
</div>
The problem, in my opinion, is that by introducing different sized grids, you've in effect tripled the complexity and overall mess of the system. I've always hated the idea of class-based grid markup. I learned to accept it with BS2 because it was simple enough that pretty much anyone could easily grok it and it was light enough that I could muck with it when needed.
If you keep the multiple column sized markup and push, pull, and offset stay then, again in my opinion, you have to provide people with an easy way to offset/push/pull in accordance to the grid system.
If you need this, you're doing it wrong.
@mdo no offense but this is a pretty arrogant statement considering that you obviously haven't thought through this.
@chanced Agreed, I think i'll look into multi-size source ordering - maybe set a variable option for it, so if pple would like to omit the functionality and reduce the weight of the grid CSS they can do so.
Also, does anyone know if there's a required version of LESS, i'd also like to convert the grid selectors to use loops, so that you actually can adjust the number of columns via @grid-columns. But the solution I plan on using will only work with LESS 1.4+.
I think that's a reasonable argument, but my question is: what's the point of having them at all if they don't have breakpoint specificity?
@mbleigh That's not a solid argument for adding them all over either. It sounds like folks are more hung up on the naming of them though, and if we rename them to be .offset-lg- then folks will also just continue to expect offsets at every level.
but eliminate offset altogether, because it seems to me that you can get the same behavior from push.
That's not correct—offsets are for skipping or spacing out columns with another column (e.g., 3 columns, one spacer column, and 8 columns).
The problem, in my opinion, is that by introducing different sized grids, you've in effect tripled the complexity and overall mess of the system.
@chanced How is the grid an overall mess? This adds the option to make the grid more complex, but you don't need to use them. Perhaps we haven't struck a solid balance yet though.
I've always hated the idea of class-based grid markup. I learned to accept it with BS2 because it was simple enough that pretty much anyone could easily grok it and it was light enough that I could muck with it when needed.
Your personal opinions aside, this is exactly why the classed based approach exists—it's easy to use and grok, especially for newcomers. The cool thing though is that all of this can be mixin-ed to any other class your heart desires if you go the Less route.
@mdo no offense but this is a pretty arrogant statement considering that you obviously haven't thought through this.
I think I was inaccurate when I said "you're doing it wrong", but I stand by the fact that adding more complexity to grid layouts will lead to more potential problems and more opportunities to put yourself in a hole for future development. If you think the grid is complicated now, this exacerbates if way more.
I didn't mean to sound arrogant, but it's shortsighted if you think I haven't thought these things through. The problem is though everyone else has thoughts of their own and feedback on having used this stuff, so naturally we might come to think things through differently.
I want to keep things as lean and simple as possible, and so I continue to push against adding features unless it's super clear that we need them. Given this thread and others, it seems like we might need to add them. I'm open to it, but to add something means making a clear and strong case for it.
Hope I didn't offend—just rather passionate about these things :).
offsets are for skipping or spacing out columns with another column
@mdo Sorry, I still don't see the different between push and offset, other than offset not working on md screens. Can you give an example?
These have the same result (push, offset):
<div class="row">
<div class="col-3">3</div>
<div class="col-8 col-push-1">8</div>
</div>
<div class="row">
<div class="col-3">3</div>
<div class="col-8 col-offset-1">8</div>
</div>
update: changed text above snippet slightly to avoid confusion
There is no difference in the grid between large and xlarge devices, so you wouldn't see a change there. See http://jsbin.com/efezub/1—notice the gap between the columns? That's what the offset does.