$line-height-base: 26;
diff --git a/demo/index.html b/demo/index.html index b21cbc8..b36a721 100644 --- a/demo/index.html +++ b/demo/index.html @@ -64,7 +64,7 @@
// cols : int - Column count
-// padding : px - Interior padding : optional
+// padding : boolean - Use grid padding : optional
@include span(cols, padding);
@@ -79,6 +79,30 @@
+// Works like span but with margins
+// cols : int - Column count
+// gutter : boolean - Use grid gutter : optional
+
+@include col(cols, padding);
+
+
+// Requires container with clear() mixin
+
+.col {
+ @include col(4);
}
Override these variables at the top of your scss file.
-
// Set base font size
$rem-base: 16px !default;
-// Set line height ratio base
-$line-height-base: 26;
+// Set line height ratio base. Accepts px, em, rem or int values
+$line-height-base: 26px !default;
// Vertical rhythm ratio
-$type-rhythm-ratio: 1.14;
-
+$type-rhythm-ratio: 1.14 !default;
// Desktop Media Query
-$desktop: "(min-width: 1024px)";
+$desktop: "(min-width: 1024px)" !default;
// Tablet Media Query
-$tablet: "(min-width: 768px) and (max-width: 1023px)";
+$tablet: "(min-width: 768px) and (max-width: 1023px)" !default;
// Mobile Media Query
-$mobile: "(max-width: 767px)";
-
+$mobile: "(max-width: 767px)" !default;
// Set Grid Column Count
-$grid-columns: 12;
-// Set Grid Gutter
-$grid-gutter: 20px;
-// Set Grid Max Width
-$grid-max-width: 1024px;
+$grid-columns: 12 !default;
+// Set Grid Gutter (percentage)
+$grid-gutter: 4 !default;
+// Set Grid Padding (as px)
+$grid-padding: 20px !default;
+// Set Grid Max Width (as px)
+$grid-max-width: 1024px !default;
$line-height-base: 26;
$line-height-base: 26px !default;
$type-rhythm-ratio: 1.14;
$type-rhythm-ratio: 1.14 !default;
$desktop: "(min-width: 1024px)";
$desktop: "(min-width: 1024px)" !default;
$tablet: "(min-width: 768px) and (max-width: 1023px)";
$tablet: "(min-width: 768px) and (max-width: 1023px)" !default;
$mobile: "(max-width: 767px)";
$mobile: "(max-width: 767px)" !default;
$grid-columns: 12;
$grid-columns: 12 !default;
Set Grid Gutter
+Set Grid Gutter (percentage)
-$grid-gutter: 20px;
$grid-gutter: 4 !default;
Set Grid Max Width
+Set Grid Padding (as px)
-$grid-max-width: 1024px;
$grid-padding: 20px !default;
Set Grid Max Width (as px)
+$grid-max-width: 1024px !default;
Strips unit suffix from value
Converts to rem, utility for rem-calc
@@ -381,18 +396,18 @@@function convert-to-rem($value, $base-value: $rem-base) {
$value: strip-unit($value) / strip-unit($base-value) * 1rem;
- @if ($value == 0rem) { $value: 0; } // Turn 0rem into 0
+ @if (strip-unit($value) == 0) { $value: 0; } // Turn 0rem into 0
@return $value;
}
Calculates rem value from number
@@ -413,11 +428,11 @@Gets grid column width
@@ -430,11 +445,11 @@Gets grid gutter
@@ -447,11 +462,11 @@Sets container styles
@@ -479,38 +494,72 @@@mixin span($cols: 4,$gutter: $grid-gutter) {
- width: percentage($cols/$grid-columns);
- max-width: $grid-max-width;
- padding-left: $gutter / 2;
- padding-right: $gutter / 2;
+ @mixin span($cols: 4, $padding: true) {
+ $column-width: $cols / $grid-columns;
+ @if $padding != false {
+ padding-left: $grid-padding;
+ padding-right: $grid-padding;
+ width: percentage($column-width);
+ }
+ width: percentage($column-width);
float: left;
}
-
@mixin col($cols: 4, $gutter: false) {
+ $column-width: $cols / $grid-columns;
+ @if $gutter != false {
+ $single-col: (100% - ($grid-gutter * ($grid-columns - 1))) / $grid-columns;
+ width: ($single-col * $cols) + ($grid-gutter * ($cols - 1));
+ margin-left: percentage($grid-gutter / 100);
+ &:first-child {
+ margin-left: 0;
+ }
+ &:last-child {
+ float: right;
+ }
+ }@else {
+ width: percentage($column-width);
+ }
+ float: left;
+}
Sets grid offet margin
@mixin offset($cols: 4,$gutter: '') {
+ @mixin offset($cols: 4) {
margin-left: percentage($cols/$grid-columns)
}
@@ -519,11 +568,11 @@ Mixins
-
+
Wraps interior content in a media query
@@ -538,75 +587,69 @@ Mixins
-
+
- @mixin transition ($properties...) {
- @if length($properties) >= 1 {
- @include prefixer(transition, $properties, webkit moz spec);
- }
-
- @else {
- $properties: all 0.15s ease-out 0s;
- @include prefixer(transition, $properties, webkit moz spec);
- }
+ @mixin transition ($property: 0.15s) {
+ @include prefixer(transition, $property, webkit moz ms);
}
-
+
@mixin transform($property: none) {
- @include prefixer(transform, $property, webkit moz ms spec);
+ @include prefixer(transform, $property, webkit moz ms);
}
-
+
@mixin box-sizing ($box) {
- @include prefixer(box-sizing, $box, webkit moz spec);
+ @include prefixer(box-sizing, $box, webkit moz);
}
-
+
@mixin prefixer ($property, $value, $prefixes) {
+ #{$property}: $value;
@each $prefix in $prefixes {
@if $prefix == webkit {
-webkit-#{$property}: $value;
@@ -617,9 +660,6 @@ Mixins
@else if $prefix == ms {
-ms-#{$property}: $value;
}
- @else if $prefix == spec {
- #{$property}: $value;
- }
@else {
@warn "Unrecognized prefix: #{$prefix}";
}
@@ -629,11 +669,11 @@ Mixins
-
+
Sets ellipsis overflow
@@ -650,11 +690,11 @@ Mixins
-
+
Clearfix include
@@ -671,11 +711,28 @@ Mixins
-
+
+
+ %clear {
+ @include clear;
+}
+
+
+
+
+
+
+
+
+ ¶
Text hider
@@ -684,46 +741,64 @@ Mixins
@mixin hide-text{
overflow:hidden;
- text-indent:-9999px;
- display:block;
+ text-indent: 100%;
+ white-space: nowrap;
}
-
+
+
+ %hide-text {
+ @include hide-text;
+}
+
+
+
+
+
+
+
+
+ ¶
Inline List
-@mixin inline-list {
+@mixin inline-list($float: true) {
list-style-type:none;
padding:0;
margin:0;
overflow:hidden;
> li{
+ @if $float == true {
display:block;
float:left;
- &:last-child{
- margin-right:0px;
- }
+ } @else {
+ display: inline-block;
+ }
}
}
-
+
Typography
@@ -732,11 +807,11 @@ Typography
-
+
Scale type at $type-rhythm-ratio
@@ -752,43 +827,50 @@ Typography
-
+
- @mixin type($rem-base: $rem-base,$line-height-base: $line-height-base, $type-rhythm-ratio: $type-rhythm-ratio){
+ @mixin type($rem-base: $rem-base,$line-height-base: $line-height-base, $type-rhythm-ratio: $type-rhythm-ratio){
+
+ @if unit($line-height-base) == "px" {
-
+
- body {
- line-height: $line-height-base / strip-unit($rem-base);
+ body {
+ line-height: strip-unit($line-height-base) / strip-unit($rem-base);
+ }
+ } @else {
+ body {
+ line-height: $line-height-base;
+ }
}
-
+
Set heading sizes to size variables
diff --git a/guff.scss b/guff.scss
index 2432c8c..a7ccd8c 100644
--- a/guff.scss
+++ b/guff.scss
@@ -65,23 +65,23 @@
// Set base font size
$rem-base: 16px !default;
// Set line height ratio base
-$line-height-base: 26;
+$line-height-base: 26px !default;
// Vertical rhythm ratio
-$type-rhythm-ratio: 1.14;
-
+$type-rhythm-ratio: 1.14 !default;
// Desktop Media Query
-$desktop: "(min-width: 1024px)";
+$desktop: "(min-width: 1024px)" !default;
// Tablet Media Query
-$tablet: "(min-width: 768px) and (max-width: 1023px)";
+$tablet: "(min-width: 768px) and (max-width: 1023px)" !default;
// Mobile Media Query
-$mobile: "(max-width: 767px)";
-
+$mobile: "(max-width: 767px)" !default;
// Set Grid Column Count
-$grid-columns: 12;
-// Set Grid Gutter
-$grid-gutter: 20px;
-// Set Grid Max Width
-$grid-max-width: 1024px;
+$grid-columns: 12 !default;
+// Set Grid Gutter (percentage)
+$grid-gutter: 4 !default;
+// Set Grid Padding (as px)
+$grid-padding: 20px !default;
+// Set Grid Max Width (as px)
+$grid-max-width: 1024px !default;
// ###Functions
// Strips unit suffix from value
@@ -92,7 +92,7 @@ $grid-max-width: 1024px;
// Converts to rem, utility for rem-calc
@function convert-to-rem($value, $base-value: $rem-base) {
$value: strip-unit($value) / strip-unit($base-value) * 1rem;
- @if ($value == 0rem) { $value: 0; } // Turn 0rem into 0
+ @if (strip-unit($value) == 0) { $value: 0; } // Turn 0rem into 0
@return $value;
}
@@ -128,16 +128,38 @@ $grid-max-width: 1024px;
}
// Sets grid column width
-@mixin span($cols: 4,$gutter: $grid-gutter) {
- width: percentage($cols/$grid-columns);
- max-width: $grid-max-width;
- padding-left: $gutter / 2;
- padding-right: $gutter / 2;
+@mixin span($cols: 4, $padding: true) {
+ $column-width: $cols / $grid-columns;
+ @if $padding != false {
+ padding-left: $grid-padding;
+ padding-right: $grid-padding;
+ width: percentage($column-width);
+ }
+ width: percentage($column-width);
+ float: left;
+}
+
+// Sets grid column width (with gutter)
+@mixin col($cols: 4, $gutter: false) {
+ $column-width: $cols / $grid-columns;
+ @if $gutter != false {
+ $single-col: (100% - ($grid-gutter * ($grid-columns - 1))) / $grid-columns;
+ width: ($single-col * $cols) + ($grid-gutter * ($cols - 1));
+ margin-left: percentage($grid-gutter / 100);
+ &:first-child {
+ margin-left: 0;
+ }
+ &:last-child {
+ float: right;
+ }
+ }@else {
+ width: percentage($column-width);
+ }
float: left;
}
// Sets grid offet margin
-@mixin offset($cols: 4,$gutter: '') {
+@mixin offset($cols: 4) {
margin-left: percentage($cols/$grid-columns)
}
@@ -149,29 +171,23 @@ $grid-max-width: 1024px;
}
// Renders fully prefixed transistion
-@mixin transition ($properties...) {
- @if length($properties) >= 1 {
- @include prefixer(transition, $properties, webkit moz spec);
- }
-
- @else {
- $properties: all 0.15s ease-out 0s;
- @include prefixer(transition, $properties, webkit moz spec);
- }
+@mixin transition ($property: 0.15s) {
+ @include prefixer(transition, $property, webkit moz ms);
}
// Renders fully prefixed transform
@mixin transform($property: none) {
- @include prefixer(transform, $property, webkit moz ms spec);
+ @include prefixer(transform, $property, webkit moz ms);
}
// Renders fully prefixed box-sizing
@mixin box-sizing ($box) {
- @include prefixer(box-sizing, $box, webkit moz spec);
+ @include prefixer(box-sizing, $box, webkit moz);
}
// Utility for prefixing mixins
@mixin prefixer ($property, $value, $prefixes) {
+ #{$property}: $value;
@each $prefix in $prefixes {
@if $prefix == webkit {
-webkit-#{$property}: $value;
@@ -182,9 +198,6 @@ $grid-max-width: 1024px;
@else if $prefix == ms {
-ms-#{$property}: $value;
}
- @else if $prefix == spec {
- #{$property}: $value;
- }
@else {
@warn "Unrecognized prefix: #{$prefix}";
}
@@ -209,27 +222,38 @@ $grid-max-width: 1024px;
}
}
+// Placeholder for clear
+%clear {
+ @include clear;
+}
+
// Text hider
@mixin hide-text{
overflow:hidden;
- text-indent:-9999px;
- display:block;
+ text-indent: 100%;
+ white-space: nowrap;
+}
+
+// Placeholder for hide-text
+%hide-text {
+ @include hide-text;
}
// Inline List
-@mixin inline-list {
+@mixin inline-list($float: true) {
list-style-type:none;
padding:0;
margin:0;
overflow:hidden;
> li{
+ @if $float == true {
display:block;
float:left;
- &:last-child{
- margin-right:0px;
- }
+ } @else {
+ display: inline-block;
+ }
}
}
// ###Typography
@@ -245,9 +269,15 @@ $h1-size: round($h2-size * $type-rhythm-ratio);
// Typographic Rhythm Mixin
@mixin type($rem-base: $rem-base,$line-height-base: $line-height-base, $type-rhythm-ratio: $type-rhythm-ratio){
- // Set line-height
- body {
- line-height: $line-height-base / strip-unit($rem-base);
+ @if unit($line-height-base) == "px" {
+ // Set line-height
+ body {
+ line-height: strip-unit($line-height-base) / strip-unit($rem-base);
+ }
+ } @else {
+ body {
+ line-height: $line-height-base;
+ }
}
// Set heading sizes to size variables
diff --git a/src/_functions.scss b/src/_functions.scss
index 41b7696..372b5fa 100644
--- a/src/_functions.scss
+++ b/src/_functions.scss
@@ -8,7 +8,7 @@
// Converts to rem, utility for rem-calc
@function convert-to-rem($value, $base-value: $rem-base) {
$value: strip-unit($value) / strip-unit($base-value) * 1rem;
- @if ($value == 0rem) { $value: 0; } // Turn 0rem into 0
+ @if (strip-unit($value) == 0) { $value: 0; } // Turn 0rem into 0
@return $value;
}
diff --git a/src/_mixins.scss b/src/_mixins.scss
index eb96743..0d8845a 100644
--- a/src/_mixins.scss
+++ b/src/_mixins.scss
@@ -8,16 +8,38 @@
}
// Sets grid column width
-@mixin span($cols: 4,$gutter: $grid-gutter) {
- width: percentage($cols/$grid-columns);
- max-width: $grid-max-width;
- padding-left: $gutter / 2;
- padding-right: $gutter / 2;
+@mixin span($cols: 4, $padding: true) {
+ $column-width: $cols / $grid-columns;
+ @if $padding != false {
+ padding-left: $grid-padding;
+ padding-right: $grid-padding;
+ width: percentage($column-width);
+ }
+ width: percentage($column-width);
+ float: left;
+}
+
+// Sets grid column width (with gutter)
+@mixin col($cols: 4, $gutter: false) {
+ $column-width: $cols / $grid-columns;
+ @if $gutter != false {
+ $single-col: (100% - ($grid-gutter * ($grid-columns - 1))) / $grid-columns;
+ width: ($single-col * $cols) + ($grid-gutter * ($cols - 1));
+ margin-left: percentage($grid-gutter / 100);
+ &:first-child {
+ margin-left: 0;
+ }
+ &:last-child {
+ float: right;
+ }
+ }@else {
+ width: percentage($column-width);
+ }
float: left;
}
// Sets grid offet margin
-@mixin offset($cols: 4,$gutter: '') {
+@mixin offset($cols: 4) {
margin-left: percentage($cols/$grid-columns)
}
@@ -29,29 +51,23 @@
}
// Renders fully prefixed transistion
-@mixin transition ($properties...) {
- @if length($properties) >= 1 {
- @include prefixer(transition, $properties, webkit moz spec);
- }
-
- @else {
- $properties: all 0.15s ease-out 0s;
- @include prefixer(transition, $properties, webkit moz spec);
- }
+@mixin transition ($property: 0.15s) {
+ @include prefixer(transition, $property, webkit moz ms);
}
// Renders fully prefixed transform
@mixin transform($property: none) {
- @include prefixer(transform, $property, webkit moz ms spec);
+ @include prefixer(transform, $property, webkit moz ms);
}
// Renders fully prefixed box-sizing
@mixin box-sizing ($box) {
- @include prefixer(box-sizing, $box, webkit moz spec);
+ @include prefixer(box-sizing, $box, webkit moz);
}
// Utility for prefixing mixins
@mixin prefixer ($property, $value, $prefixes) {
+ #{$property}: $value;
@each $prefix in $prefixes {
@if $prefix == webkit {
-webkit-#{$property}: $value;
@@ -62,9 +78,6 @@
@else if $prefix == ms {
-ms-#{$property}: $value;
}
- @else if $prefix == spec {
- #{$property}: $value;
- }
@else {
@warn "Unrecognized prefix: #{$prefix}";
}
@@ -89,26 +102,37 @@
}
}
+// Placeholder for clear
+%clear {
+ @include clear;
+}
+
// Text hider
@mixin hide-text{
overflow:hidden;
- text-indent:-9999px;
- display:block;
+ text-indent: 100%;
+ white-space: nowrap;
+}
+
+// Placeholder for hide-text
+%hide-text {
+ @include hide-text;
}
// Inline List
-@mixin inline-list {
+@mixin inline-list($float: true) {
list-style-type:none;
padding:0;
margin:0;
overflow:hidden;
> li{
+ @if $float == true {
display:block;
float:left;
- &:last-child{
- margin-right:0px;
- }
+ } @else {
+ display: inline-block;
+ }
}
}
\ No newline at end of file
diff --git a/src/_settings.scss b/src/_settings.scss
index afb70c9..211554e 100644
--- a/src/_settings.scss
+++ b/src/_settings.scss
@@ -3,20 +3,20 @@
// Set base font size
$rem-base: 16px !default;
// Set line height ratio base
-$line-height-base: 26;
+$line-height-base: 26px !default;
// Vertical rhythm ratio
-$type-rhythm-ratio: 1.14;
-
+$type-rhythm-ratio: 1.14 !default;
// Desktop Media Query
-$desktop: "(min-width: 1024px)";
+$desktop: "(min-width: 1024px)" !default;
// Tablet Media Query
-$tablet: "(min-width: 768px) and (max-width: 1023px)";
+$tablet: "(min-width: 768px) and (max-width: 1023px)" !default;
// Mobile Media Query
-$mobile: "(max-width: 767px)";
-
+$mobile: "(max-width: 767px)" !default;
// Set Grid Column Count
-$grid-columns: 12;
-// Set Grid Gutter
-$grid-gutter: 20px;
-// Set Grid Max Width
-$grid-max-width: 1024px;
\ No newline at end of file
+$grid-columns: 12 !default;
+// Set Grid Gutter (percentage)
+$grid-gutter: 4 !default;
+// Set Grid Padding (as px)
+$grid-padding: 20px !default;
+// Set Grid Max Width (as px)
+$grid-max-width: 1024px !default;
\ No newline at end of file
diff --git a/src/_typography.scss b/src/_typography.scss
index 5f506bd..e942245 100644
--- a/src/_typography.scss
+++ b/src/_typography.scss
@@ -11,9 +11,15 @@ $h1-size: round($h2-size * $type-rhythm-ratio);
// Typographic Rhythm Mixin
@mixin type($rem-base: $rem-base,$line-height-base: $line-height-base, $type-rhythm-ratio: $type-rhythm-ratio){
- // Set line-height
- body {
- line-height: $line-height-base / strip-unit($rem-base);
+ @if unit($line-height-base) == "px" {
+ // Set line-height
+ body {
+ line-height: strip-unit($line-height-base) / strip-unit($rem-base);
+ }
+ } @else {
+ body {
+ line-height: $line-height-base;
+ }
}
// Set heading sizes to size variables