Skip to content

Instantly share code, notes, and snippets.

@zapatoche
Created September 1, 2011 09:48
Show Gist options
  • Select an option

  • Save zapatoche/1185841 to your computer and use it in GitHub Desktop.

Select an option

Save zapatoche/1185841 to your computer and use it in GitHub Desktop.
$totalCols: 7
$fullWidth: $totalCols
$unitWidth: 118px
$gutterWidth: 20px
//$totalWidth: ($unitWidth * $totalCols) + (($unitWidth * $gutterRatio) * ($totalCols - 1))
$totalWidth: $fullWidth * $unitWidth
//$gutterRatio: ($gutterWidth * 100) / $totalWidth
//function calculate width grid cell
@function getBaseWidth($n)
$baseWidth: $unitWidth * $n
$percentBaseWidth: percentOf($baseWidth, $totalWidth)
$percentPaddingWidth: percentOf($gutterWidth, $baseWidth)
$computedWidth: $percentBaseWidth - $percentPaddingWidth
@return $computedWidth, $percentPaddingWidth, $percentBaseWidth
@function getPadding($n)
@return ($gutterWidth * 100) / $n
@function percentOf($target, $base)
//@return ($target * 100) / $base
@return ($target / $base) * 100
@function offset($n)
@return #{nth(getBaseWidth($n), 3) + "%"}
@mixin columns($n)
width: #{nth(getBaseWidth($n), 1) + "%"}
padding: 0 #{nth(getBaseWidth($n), 2) + "%"}
+float-left
@import compass/reset
@import compass/utilities
@import compass/css3
@import compass/typography
#container
//width: ceil($totalWidth)
width: $totalWidth
+pie-clearfix
background: #ccc
margin: 0 auto
article
width: 100%
margin: 1em 0
+pie-clearfix
h1
+columns(7)
//margin-left: offset(1)
font:
size: 22px
p
+columns(2)
&:first-of-type
margin-left: offset(1)
hgroup
overflow: hidden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment