Permalink
Browse files

Added offset calculation changes suggested by ethern8, and added .off…

…setX:first-child class generation to the grid-fluid mixin.
  • Loading branch information...
1 parent 1461753 commit 71fea1ffdf9d431f29d58b38f49471b46485f15f @trabus trabus committed Sep 24, 2012
@@ -582,13 +582,13 @@
}
@mixin fluid-offset($columns, $columnWidth: $fluidGridColumnWidth, $gutterWidth: $fluidGridGutterWidth) {
- margin-left: ($columnWidth * $columns) + ($gutterWidth * ($columns + 1)) + ($gutterWidth * 2);
- *margin-left: ($columnWidth * $columns) + ($gutterWidth * ($columns + 1)) - (.5 / $gridRowWidth * 100px * 1%) + ($gutterWidth * 2) - (.5 / $gridRowWidth * 100px * 1%);
+ margin-left: ($columnWidth * $columns) + ($gutterWidth * ($columns - 1)) + ($gutterWidth * 2);
+ *margin-left: ($columnWidth * $columns) + ($gutterWidth * ($columns - 1)) - (.5 / $gridRowWidth * 100px * 1%) + ($gutterWidth * 2) - (.5 / $gridRowWidth * 100px * 1%);
}
@mixin fluid-offset-first-child($columns, $columnWidth: $fluidGridColumnWidth, $gutterWidth: $fluidGridGutterWidth) {
- margin-left: ($columnWidth * $columns) + ($gutterWidth * ($columns + 1)) + ($gutterWidth * 2);
- *margin-left: ($columnWidth * $columns) + ($gutterWidth * ($columns + 1)) - (.5 / $gridRowWidth * 100px * 1%) + $gutterWidth - (.5 / $gridRowWidth * 100px * 1%);
+ margin-left: ($columnWidth * $columns) + ($gutterWidth * ($columns - 1)) + $gutterWidth;
+ *margin-left: ($columnWidth * $columns) + ($gutterWidth * ($columns - 1)) - (.5 / $gridRowWidth * 100px * 1%) + $gutterWidth - (.5 / $gridRowWidth * 100px * 1%);
}
@mixin fluid-span($columns, $columnWidth: $fluidGridColumnWidth, $gutterWidth: $fluidGridGutterWidth) {
@@ -606,7 +606,7 @@
margin-left: $gutterWidth;
*margin-left: $gutterWidth - (.5 / $gridRowWidth * 100px * 1%);
}
- [class*="span"]:first-child:not([class*="offset"]) {
+ [class*="span"]:first-child {
margin-left: 0;
}
@@ -619,6 +619,9 @@
.offset#{$i} {
@include fluid-offset($i, $columnWidth, $gutterWidth);
}
+ .offset#{$i} {
+ @include fluid-offset-first-child($i, $columnWidth, $gutterWidth);
+ }
$i: $i - 1;
}
}
@@ -530,12 +530,12 @@
$i: $i - 1
=fluid-offset($columns, $columnWidth: $fluidGridColumnWidth, $gutterWidth: $fluidGridGutterWidth)
- margin-left: $columnWidth * $columns + $gutterWidth * ($columns + 1) + $gutterWidth * 2
- *margin-left: $columnWidth * $columns + $gutterWidth * ($columns + 1) - 0.5 / $gridRowWidth * 100px * 1% + $gutterWidth * 2 - 0.5 / $gridRowWidth * 100px * 1%
+ margin-left: $columnWidth * $columns + $gutterWidth * ($columns - 1) + $gutterWidth * 2
+ *margin-left: $columnWidth * $columns + $gutterWidth * ($columns - 1) - 0.5 / $gridRowWidth * 100px * 1% + $gutterWidth * 2 - 0.5 / $gridRowWidth * 100px * 1%
=fluid-offset-first-child($columns, $columnWidth: $fluidGridColumnWidth, $gutterWidth: $fluidGridGutterWidth)
- margin-left: $columnWidth * $columns + $gutterWidth * ($columns + 1) + $gutterWidth * 2
- *margin-left: $columnWidth * $columns + $gutterWidth * ($columns + 1) - 0.5 / $gridRowWidth * 100px * 1% + $gutterWidth - 0.5 / $gridRowWidth * 100px * 1%
+ margin-left: $columnWidth * $columns + $gutterWidth * ($columns - 1) + $gutterWidth
+ *margin-left: $columnWidth * $columns + $gutterWidth * ($columns - 1) - 0.5 / $gridRowWidth * 100px * 1% + $gutterWidth - 0.5 / $gridRowWidth * 100px * 1%
=fluid-span($columns, $columnWidth: $fluidGridColumnWidth, $gutterWidth: $fluidGridGutterWidth)
width: $columnWidth * $columns + $gutterWidth * ($columns - 1)
@@ -557,7 +557,10 @@
@while $i > 0
.span#{$i}
+fluid-span($i, $columnWidth, $gutterWidth)
+ .offset#{$i}
+fluid-offset($i, $columnWidth, $gutterWidth)
+ .offset#{$i}:first-child
+ +fluid-offset-first-child($i, $columnWidth, $gutterWidth)
$i: $i - 1
=input-span($columns, $columnWidth: $gridColumnWidth, $gutterWidth: $gridGutterWidth)

0 comments on commit 71fea1f

Please sign in to comment.