_normalize.scss in normalize-scss-2.2.0 vs _normalize.scss in normalize-scss-3.0.0.alpha.1
- old
+ new
@@ -1,31 +1,40 @@
-/* normalize.scss 2.2.0+normalize.2.1.3 | MIT/GPLv2 License | bit.ly/normalize-with-compass */
+/* normalize.scss 3.0.0-alpha.1+normalize.2.1.3 | MIT/GPLv2 License | bit.ly/normalize-with-compass */
// =============================================================================
// Variables and Imports
//
// If you have a base partial (or equivalent), you should move these lines to
// that file. NOTE: Edit the lines to remove "!default".
// @see http://compass-style.org/help/tutorials/best_practices/
// =============================================================================
-// These 2 variables are copies of ones used in Compass' Vertical Rhythm module.
+// These 3 variables are copies of ones used in Compass' Vertical Rhythm module.
// The base font size.
$base-font-size: 16px !default;
// The base line height determines the basic unit of vertical rhythm.
$base-line-height: 24px !default;
-// These 2 variables are copies of ones used in Compass' support module.
+ // The length unit in which to output vertical rhythm values.
+ // Supported values: px, em, rem.
+ $rhythm-unit: 'em' !default;
- // Set this to true to add support for IE 6.
- $legacy-support-for-ie6: false !default;
+// This variable is a copy of the one used in Compass' support module.
- // Set this to true to add support for IE 7.
- $legacy-support-for-ie7: false !default;
+ // Optional map of minimum browser versions to support. For example, to
+ // remove support for IE 7 and earlier, set $browser-minimum-versions['ie']
+ // to '8'.
+ $browser-minimum-versions: (
+ 'chrome': null,
+ 'firefox': null,
+ 'ie': null,
+ 'safari': null,
+ 'opera': null
+ ) !default;
// Set this to true to force CSS output to exactly match normalize.css.
$strict-normalize: true !default;
@@ -47,10 +56,31 @@
@import "compass/support";
@import "compass/css3/box-sizing";
@import "compass/typography/vertical_rhythm";
+// To work around a bug in Compass 1.0.0-alpha.17, we override Compass'
+// support-legacy-browser() function with a version of our own.
+// @TODO Remove this monkey patch after it's fixed in Compass.
+// @see https://github.com/chriseppstein/compass/pull/1524
+@function support-legacy-browser($browser, $min-version, $max-version: null, $threshold: $critical-usage-threshold) {
+ @if not index($supported-browsers, $browser) {
+ @return false;
+ }
+ // Check against declared minimums.
+ $min-required-version: map-get($browser-minimum-versions, $browser);
+ @if $min-required-version {
+ @return compare-browser-versions($browser, $max-version or $min-version, $min-required-version) >= 0;
+ } @else {
+ // Check against usage stats.
+ $usage: if($max-version,
+ omitted-usage($browser, $min-version, $max-version),
+ omitted-usage($browser, $min-version));
+ @return $usage > $threshold;
+ }
+}
+
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
@@ -78,11 +108,11 @@
audio,
canvas,
video {
display: inline-block;
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+ @if support-legacy-browser(ie, "7") {
*display: inline;
*zoom: 1;
}
}
@@ -108,33 +138,35 @@
/* ==========================================================================
Base
========================================================================== */
+@if not $strict-normalize or support-legacy-browser(ie, "7") {
+ /**
+ * Establish a vertical rhythm unit using $base-font-size, $base-line-height,
+ * and $rhythm-unit variables. Also, correct text resizing oddly in IE 6/7 when
+ * body `font-size` is set using `em` units.
+ */
+
+ @include establish-baseline();
+}
+
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
- * 3. Correct text resizing oddly in IE 6/7 when body `font-size` is set using
- * `em` units.
*/
html {
font-family: $base-font-family; /* 1 */
- @if not $strict-normalize or $legacy-support-for-ie6 or $legacy-support-for-ie7 {
- font-size: 100% * ($base-font-size / 16px); /* 3 */
- }
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
-
- @if not $strict-normalize {
- /* Establish a vertical rhythm unit using $base-line-height. */
- @include adjust-leading-to(1);
- }
+ // Show a background image that can be used to debug your alignments.
+ // @include debug-vertical-alignment();
}
-@if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+@if support-legacy-browser(ie, "7") {
/**
* Address `font-family` inconsistency between `textarea` and other form
* elements.
*/
@@ -185,11 +217,11 @@
/* ==========================================================================
Typography
========================================================================== */
-@if not $strict-normalize or $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+@if not $strict-normalize or support-legacy-browser(ie, "7") {
/**
* Set 1 unit of vertical rhythm on the top and bottom margin.
*/
p,
@@ -208,23 +240,23 @@
* contexts in Firefox 4+, Safari 5, and Chrome.
*/
h1 {
/* Set the font-size and line-height while keeping a proper vertical rhythm. */
- @if not $strict-normalize or $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+ @if not $strict-normalize or support-legacy-browser(ie, "7") {
@include adjust-font-size-to( $h1-font-size );
}
@else {
- font-size: 1em * ($h1-font-size / $base-font-size);
+ font-size: if($rhythm-unit == "px", $h1-font-size, ($h1-font-size / $base-font-size)#{$rhythm-unit});
}
/* Set 1 unit of vertical rhythm on the top and bottom margins. */
@include leader(1, $h1-font-size);
@include trailer(1, $h1-font-size);
}
-@if not $strict-normalize or $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+@if not $strict-normalize or support-legacy-browser(ie, "7") {
h2 {
@include adjust-font-size-to( $h2-font-size );
@include leader(1, $h2-font-size);
@include trailer(1, $h2-font-size);
}
@@ -304,22 +336,22 @@
code,
kbd,
pre,
samp {
font-family: monospace, serif;
- @if $legacy-support-for-ie6 {
+ @if support-legacy-browser(ie, "6") {
_font-family: 'courier new', monospace;
}
font-size: 1em;
}
/**
* Improve readability of pre-formatted text in all browsers.
*/
pre {
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+ @if support-legacy-browser(ie, "7") {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
@else {
@@ -365,11 +397,11 @@
/* ==========================================================================
Lists
========================================================================== */
-@if not $strict-normalize or $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+@if not $strict-normalize or support-legacy-browser(ie, "7") {
/**
* Address margins set differently in IE 6/7.
*/
dl,
@@ -402,11 +434,11 @@
ul {
padding: 0 0 0 $indent-amount;
}
}
-@if $legacy-support-for-ie7 {
+@if support-legacy-browser(ie, "7") {
/**
* Correct list images handled incorrectly in IE 7.
*/
nav ul,
@@ -424,11 +456,11 @@
* Remove border when inside `a` element in IE 8/9.
*/
img {
border: 0;
- @if $legacy-support-for-ie7 {
+ @if support-legacy-browser(ie, "7") {
/* Improve image quality when scaled in IE 7. */
-ms-interpolation-mode: bicubic;
}
}
@@ -454,11 +486,11 @@
/* ==========================================================================
Forms
========================================================================== */
-@if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+@if support-legacy-browser(ie, "7") {
/**
* Correct margin displayed oddly in IE 6/7.
*/
form {
@@ -487,11 +519,11 @@
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+ @if support-legacy-browser(ie, "7") {
*margin-left: -7px; /* 3 */
}
}
/**
@@ -506,11 +538,11 @@
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 2 */
margin: 0; /* 3 */
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
+ @if support-legacy-browser(ie, "7") {
vertical-align: baseline; /* 4 */
*vertical-align: middle; /* 4 */
}
}
@@ -550,11 +582,11 @@
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
- @if $legacy-support-for-ie7 {
+ @if support-legacy-browser(ie, "7") {
*overflow: visible; /* 4 */
}
}
/**
@@ -575,10 +607,10 @@
input[type="checkbox"],
input[type="radio"] {
@include box-sizing(border-box); /* 1 */
padding: 0; /* 2 */
- @if $legacy-support-for-ie7 {
+ @if support-legacy-browser(ie, "7") {
*height: 13px; /* 3 */
*width: 13px; /* 3 */
}
}