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

col-offset #6

Closed
gaurav21r opened this issue Jun 13, 2015 · 4 comments
Closed

col-offset #6

gaurav21r opened this issue Jun 13, 2015 · 4 comments

Comments

@gaurav21r
Copy link

Wow! @chrisnager ! This is amazing!

Wondering, how to implement an offset like bootstrap's. http://getbootstrap.com/css/#grid-offsetting

@chrisnager
Copy link
Owner

thanks @gaurav21r! I didn't initially have a way to offset columns with ungrid, but here's a way you could do it. Set a width on the column you intend to offset and add another hidden column to take up the remaining space in the row.

<div class="row">
    <div class="col" style="visibility:hidden"></div>
    <div class="col" style="width:25%">Offset</div>
</div>

hope that helps!

@gaurav21r
Copy link
Author

@chrisnager Yep! Workable! Its just that it leads to "div soup". Using so many tags without proper semantics is not advisable on most of the web. I don't know if this contradicts with ungrid's philosophy but perhaps you could keep this issue open till we find a better solution (that doesn't need us to create extra divs)

@Rplus
Copy link

Rplus commented Aug 21, 2015

👍

@nathco
Copy link

nathco commented Dec 20, 2016

Another solution without using extra markup is to insert empty cells with :before and :after pseudo elements. Downside is you can't offset "between" elements, but in many cases this works perfectly fine.

Demo: https://jsfiddle.net/8kbvvd3m/

Alternatively, you can add empty-cells: hide; to the .row class and use an empty .col or <br> where you want offset space. However, this is not the best practice and becomes harder to maintain.

Demo: https://jsfiddle.net/1mzf6h0f/

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

No branches or pull requests

4 participants