-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
Create grid system classes repeated code #461
Comments
You might be able to use the
The output should look like:
|
But you does not change the width. |
No problem, this: |
I does not want to generate the width, for this i use susy mixin span. you solution is not good. look at my example in the issue. |
This could be fixed if Susy had an I tried to do this with my grid system but where it's pretty dependent on |
How you output only the width? |
I don't think Susy offers this ability, but I'm saying it would be a fairly easy fix for them. Consider this really dumbed down code: @mixin grid-column($fraction) {
float: left;
margin-left: 15px;
margin-right: 15px;
width: 100% * $fraction;
} If there were an @mixin grid-column($fraction, $output: normal) {
@if ($output == normal) or ($output == init) {
float: left;
margin-left: 15px;
margin-right: 15px;
}
@if ($output == normal) or ($output == bare) {
width: 100% * $fraction;
}
} Then someone could say: [class*="col-"] {
@include grid-column($output: init);
}
@for $i from 1 through 12 {
.col-#{$i} {
@include grid-column($i/12, $output: bare);
}
} And the code outputted would be: [class*="col-"] {
float: left;
margin-left: 15px;
margin-right: 15px;
}
.col-1 {
width: 8.333333333%;
}
.col-2 {
width: 16.666666667%;
}
etc... And if someone didn't want to use CSS classes, it would default to rendering all the styles. |
Look good, so maybe you are gonna do a pull request? |
This is a duplicate of #143. Susy takes a different approach to the repetition issue. Rather than adding new parameters for every use case, we provide all the functions you need to customize your own system. If you want just the @include border-box-sizing;
[class*="col-"] {
@include gutters;
float: left;
}
@for $i from 1 through 12 {
.col-#{$i} {
width: span($i of 12);
}
} |
👍 I think I like your solution better @ericam |
Thanks this is what i want :) |
I am trying to make grid system classes like boostrap has, but the problem is i have repeated code in every class like this:
There is a way to get around this problem?
The text was updated successfully, but these errors were encountered: