KNACSS/sass/knacss.scss
2013-04-07 11:33:23 +02:00

616 lines
11 KiB
SCSS

/*
* www.KNACSS.com V2.6d @author: Raphael Goetter, Alsacreations
* Licence CC-BY http://creativecommons.org/licenses/by/3.0/fr/
*/
/* Compass imports */
@import "compass/css3";
/* ----------------------------- */
/* ==helpers */
/* ----------------------------- */
/**
* Mixin handling REM with PX fallback
* Takes either PX or REM as input
* Outputs both in appropriate order
*/
@mixin rem($property, $values) {
$px : ();
$rem: ();
@each $value in $values {
@if $value == 0 or $value == auto {
$px : append($px , $value);
$rem: append($rem, $value);
}
@else {
$unit: unit($value);
$val: $value / ($value * 0 + 1);
@if $unit == "px" {
$px : append($px, $value);
$rem: append($rem, ($val / 10 + rem));
}
@if $unit == "rem" {
$px : append($px, ($val * 10 + px));
$rem: append($rem, $value);
}
}
}
#{$property}: $px;
#{$property}: $rem;
}
@mixin r($breakpoint) {
@if $breakpoint == "large" {
@media (min-width: 1280px) { @content; }
}
@if $breakpoint == "medium" {
@media (max-width: 768px) { @content; }
}
@if $breakpoint == "small" {
@media (max-width: 640px) { @content; }
}
}
/**
* Clearfix
*/
.clearfix:after {
content: '';
clear: both;
display: table;
}
/**
* Hidden yet accessible content
*/
.visuallyhidden {
clip: rect(0 0 0 0);
width: 1px;
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
border: 0;
position: absolute;
}
/* ----------------------------- */
/* ==reset */
/* ----------------------------- */
/**
* 1. Base font-size (corresponds to 10px) adapted to REM unit
* 2. Orientation iOS font-size fix
*/
html {
font-size: 62.5%; /* 1 */
@media (orientation: landscape) and (max-device-width: 768px) {
-webkit-text-size-adjust: 100%; /* 2 */
}
}
body {
background-color: #fff;
color: #000;
font-family: "Century Gothic", helvetica, arial, sans-serif;
@include rem('font-size', 14px);
line-height: 1.5;
}
/**
* Font-sizing for content
* Preserves vertical-rythm
* Source: http://soqr.fr/vertical-rhythm/
*/
p, ul, ol, dl,
blockquote, pre,
td, th,
label, textarea,
caption, details, figure, hgroup {
@include rem('font-size', 14px);
line-height: 1.5;
margin: .75em 0 0;
}
h1, .h1-like,
h2, .h2-like,
h3, .h3-like,
h4, .h4-like,
h5, .h5-like,
h6, .h6-like {
font-weight: normal;
@include rem('margin', 21px 0 0 0);
}
h1, .h1-like,
h2, .h2-like,
h3, .h3-like {
@include rem('line-height', 42px 0 0 0);
}
h4, .h4-like,
h5, .h5-like,
h6, .h6-like {
@include rem('line-height', 21px 0 0 0);
}
h1, .h1-like { @include rem('font-size', 26px); }
h2, .h2-like { @include rem('font-size', 24px); }
h3, .h3-like { @include rem('font-size', 22px); }
h4, .h4-like { @include rem('font-size', 20px); }
h5, .h5-like { @include rem('font-size', 18px); }
h6, .h6-like { @include rem('font-size', 16px); }
/* alternate font-sizing */
.smaller { @include rem('font-size', 10px); }
.small { @include rem('font-size', 12px); }
.medium { @include rem('font-size', 14px); }
.big { @include rem('font-size', 16px); }
.bigger { @include rem('font-size', 18px); }
.biggest { @include rem('font-size', 20px); }
/**
* Soft reset
*/
html, body,
textarea,
figure, label {
margin: 0;
padding: 0;
}
ul, ol {
padding-left: 2em;
&.unstyled {
list-style: none;
}
}
code, pre,
samp, kbd {
white-space: pre-wrap;
font-family: consolas, 'DejaVu Sans Mono', courier, monospace;
line-height: 1em;
}
code, kbd, mark {
border-radius: 2px;
}
em {
font-style: italic;
}
strong {
font-weight: bold;
}
kbd {
padding: 0 2px;
border: 1px solid #999;
}
code {
padding: 2px 4px;
background: rgba(0,0,0,.04);
color: #b11;
}
mark {
padding:2px 4px;
background: #ff0;
}
table {
margin-bottom: 1.5em;
}
/**
* Avoid top margins on first content element
*/
p, ul, ol dl,
blockquote, pre,
h1, h2, h3, h4, h5, h6 {
&:first-child {
margin-top: 0;
}
}
/**
* Avoid margins on nested elements
*/
li {
p, ul, ol {
margin-top: 0;
margin-bottom: 0;
}
}
/**
* Prevents those to break out of their container
*/
img, table, td,
blockquote, code, pre,
textarea, input, video {
max-width: 100%;
}
/**
* You shall not pass
*/
div, textarea,
table, td, th,
code, pre, samp {
word-wrap: break-word;
@include hyphens(auto);
}
/**
* Pictures
*/
img {
height: auto;
vertical-align: middle;
/* Gmap3 max-width bug fix on images */
#map_canvas &,
.gmnoprint & {
max-width: none;
}
a & {
border: 0;
}
}
/* scripts */
body > script { display: none !important; }
/* skip-links */
.skip-links {
position: absolute;
a {
position: absolute;
left: -7000px;
padding: 0.5em;
background: #000;
color:#fff;
text-decoration: none;
&:focus {
position: static;
}
}
}
/* ----------------------------- */
/* ==layout and modules */
/* ----------------------------- */
/**
* Switching box-model for all elements
* 1. ...and pseudo-elements
*/
*,
*:after, /* 1 */
*:before {
@include box-sizing(border-box);
}
/**
* Float layout
* module, contains floats (.item is the same)
*/
.mod, .item {
overflow: hidden;
}
/**
* Blocks that needs to be placed under floats
*/
.clear, .line, .row {
clear: both;
}
/**
* Blocks that must contain floats
*/
.clearfix, .line, .mod {
@extend .clearfix;
}
/**
* Table layout
*/
.row {
display: table;
table-layout: fixed;
width: 100%;
}
.row > *,
.col {
display: table-cell;
vertical-align: top;
}
/**
* Inline-blocks
*/
.inbl {
@include inline-block(top);
margin-right: -.25em;
}
/**
* Flexbox layout
*/
.flex {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.flex-h {
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
}
.flex-v {
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.flex-fluid {
-webkit-box-flox: 1;
-moz-box-flex: 1;
-webkit-flex: 1;
-moz-flex: 1;
-ms-flex: 1;
flex: 1;
}
.flex-start {
-webkit-box-ordinal-group: -1;
-moz-box-ordinal-group: 0;
-ms-flex-order: -1;
-webkit-order: -1;
-moz-order: -1;
order: -1;
}
.flex-mid {
-webkit-box-ordinal-group: 1;
-moz-box-ordinal-group: 1;
-ms-flex-order: 1;
-webkit-order: 1;
-moz-order: 1;
order: 1;
}
.flex-end {
-webkit-box-ordinal-group: 42;
-moz-box-ordinal-group: 42;
-ms-flex-order: 42;
-webkit-order: 42;
-moz-order: 42;
order: 42;
}
/* Alignments (blocks and inline) */
/* ------------------------------ */
.left { float: left; }
.right { float: right; }
img.left { margin-right: 1em; }
img.right { margin-left: 1em; }
img.left,
img.right { margin-bottom: 5px; }
.center { margin-left: auto; margin-right: auto; }
.txtleft { text-align: left; }
.txtright { text-align: right; }
.txtcenter { text-align: center; }
/**
* Blocks widths
* (percentages and pixels)
*/
.w10 { width: 10%; }
.w20 { width: 20%; }
.w25 { width: 25%; }
.w30 { width: 30%; }
.w33 { width: 33.333%; }
.w40 { width: 40%; }
.w50 { width: 50%; }
.w60 { width: 60%; }
.w66 { width: 66.666%; }
.w70 { width: 70%; }
.w75 { width: 75%; }
.w80 { width: 80%; }
.w90 { width: 90%; }
.w100 { width: 100%; }
.w50p { width: 50px; }
.w100p { width: 100px; }
.w150p { width: 150px; }
.w200p { width: 200px; }
.w300p { width: 300px; }
.w400p { width: 400px; }
.w500p { width: 500px; }
.w600p { width: 600px; }
.w700p { width: 700px; }
.w800p { width: 800px; }
.w960p { width: 960px; }
.mw960p { max-width: 960px; }
/**
* Spacing helpers
* p, m = padding,margin
* a, t, r, b, l = all, top, right, bottom, left
* s, m, l, n, 0 = small(10px), medium(20px), large(30px), zero or none(0)
* Source: https://github.com/stubbornella/oocss/blob/master/core/spacing/space.css
*/
.m-reset, .ma0 { margin: 0 !important; }
.p-reset, .pa0 { padding: 0 !important; }
.ma1, .mas { margin: 10px !important; }
.ma2, .mam { margin: 20px !important; }
.ma3, .mal { margin: 30px !important; }
.pa1, .pas { padding: 10px; }
.pa2, .pam { padding: 20px; }
.pa3, .pal { padding: 30px; }
.mt0, .mtn { margin-top: 0 !important; }
.mt1, .mts { margin-top: 10px !important; }
.mt2, .mtm { margin-top: 20px !important; }
.mt3, .mtl { margin-top: 30px !important; }
.mr0, .mrn { margin-right: 0; }
.mr1, .mrs { margin-right: 10px; }
.mr2, .mrm { margin-right: 20px; }
.mr3, .mrl { margin-right: 30px; }
.mb0, .mbn { margin-bottom: 0 !important; }
.mb1, .mbs { margin-bottom: 10px !important; }
.mb2, .mbm { margin-bottom: 20px !important; }
.mb3, .mbl { margin-bottom: 30px !important; }
.ml0, .mln { margin-left: 0; }
.ml1, .mls { margin-left: 10px; }
.ml2, .mlm { margin-left: 20px; }
.ml3, .mll { margin-left: 30px; }
.pt0, .ptn { padding-top: 0; }
.pt1, .pts { padding-top: 10px; }
.pt2, .ptm { padding-top: 20px; }
.pt3, .ptl { padding-top: 30px; }
.pr0, .prn { padding-right: 0; }
.pr1, .prs { padding-right: 10px; }
.pr2, .prm { padding-right: 20px; }
.pr3, .prl { padding-right: 30px; }
.pb0, .pbn { padding-bottom: 0; }
.pb1, .pbs { padding-bottom: 10px; }
.pb2, .pbm { padding-bottom: 20px; }
.pb3, .pbl { padding-bottom: 30px; }
.pl0, .pln { padding-left: 0; }
.pl1, .pls { padding-left: 10px; }
.pl2, .plm { padding-left: 20px; }
.pl3, .pll { padding-left: 30px; }
.desktop-hidden { display: none; } /* hidden on desktop */
/* ----------------------------- */
/* ==header */
/* ----------------------------- */
/* ----------------------------- */
/* ==sidebar */
/* ----------------------------- */
/* ----------------------------- */
/* ==footer */
/* ----------------------------- */
/* ----------------------------- */
/* ==forms */
/* ----------------------------- */
form,
fieldset {
border: none;
}
/**
* 1. Bugfix alignment
*/
input,
button, select,
label, .btn {
vertical-align: middle; /* 1 */
font-family: inherit;
}
/**
* 1. Prevents horizontal resizing
*/
textarea {
resize: vertical; /* 1 */
font-family: inherit;
}
/* ----------------------------- */
/* ==main */
/* ----------------------------- */
/* ----------------------------- */
/* ==iefix */
/* ----------------------------- */
/* HasLayout for IE6/IE7 */
.ie67 {
.clearfix, .line, .mod, .row, .col {
zoom: 1;
}
/* Warning: .col needs a width on IE6/IE7 */
.col {
display: inline;
zoom: 1;
}
/**
* Add a slash at the end of this comment
* If you want to enable box-sizing for IE6/IE7
* with a polyfill
* Source: https://github.com/Schepp/box-sizing-polyfill *
* {
behavior: url(/js/boxsizing.htc);
}
/**/
}
/**
* 1. Bugfixes for IE8
*/
.ie8 img {
width: auto; /* 1 */
}
/* ----------------------------- */
/* ==print */
/* ----------------------------- */
/* Quick print reset */
@media print {
p, blockquote {
orphans: 2;
widows: 2;
}
blockquote,
ul, ol {
page-break-inside: avoid;
}
h1, h2, h3,
caption {
page-break-after: avoid;
}
}