-
Notifications
You must be signed in to change notification settings - Fork 21
/
_skeleton.scss
160 lines (123 loc) · 4.72 KB
/
_skeleton.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
* Skeleton-Sass V1.0
* Copyright 2012 by Michael Lazer-Walker
* https://github.com/lazerwalker/Skeleton-Sass
*
* Based off of Skeleton v1.1:
* https://github.com/dhgamache/Skeleton
*
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
/* Prevent margins and paddings from adding or subtracting to the column size
===================================================*/
*, *:before, *:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* #Variable Definitions
================================================== */
$base-width: 960px;
$tablet-width: 768px;
$mobile-portrait-width: 300px;
$mobile-landscape-width: 420px;
$num-columns: 16;
$margin: 10px;
$topMaxWidth: 959px;
$topMinWidth: 768px;
$medMaxWidth: $topMinWidth - 1;
$botMaxWidth: $medMaxWidth;
$botMinWidth: 480px;
/* Grid
================================================== */
@function skeleton-third-width($num: 1, $width: $base-width) {
@return $num * ($width / 3) - (2 * $margin); }
@function skeleton-column-width($num: 1, $width: $base-width) {
@return ($num * ($width / $num-columns)) - (2 * $margin); }
@mixin container {
position: relative;
margin: 0 auto;
padding: 0;
width: $base-width;
&:after {
content: "\0020";
display: block;
height: 0;
clear: both;
visibility: hidden; }
@media only screen and (min-width: $topMinWidth ) and (max-width: $topMaxWidth ) {
width: $tablet-width; }
@media only screen and (max-width: $medMaxWidth) {
width: $mobile-portrait-width; }
@media only screen and (min-width: $botMinWidth ) and (max-width: $botMaxWidth ) {
width: $mobile-landscape-width; } }
@mixin column {
float: left;
display: inline;
margin-left: $margin;
margin-right: $margin;
@media only screen and (max-width: $medMaxWidth ) { margin: 0; } }
@mixin row {
@include clearfix;
margin-bottom: 2 * $margin; }
@mixin alpha { margin-left: 0; }
@mixin omega { margin-right: 0; }
@mixin columns($num: 1) {
@include column;
width: skeleton-column-width($num, $base-width);
@media only screen and (min-width: $topMinWidth ) and (max-width: $topMaxWidth ) {
width: skeleton-column-width($num, $tablet-width); }
@media only screen and (max-width: $medMaxWidth) {
width: $mobile-portrait-width; }
@media only screen and (min-width: $botMinWidth ) and (max-width: $botMaxWidth ) {
width: $mobile-landscape-width; } }
@mixin fullColumns($num: 1) {
@include column;
@include alpha;
@include omega;
width: skeleton-column-width($num, $base-width);
@media only screen and (min-width: $topMinWidth ) and (max-width: $topMaxWidth ) {
width: skeleton-column-width($num, $tablet-width); }
@media only screen and (max-width: $medMaxWidth ) {
width: $mobile-portrait-width; }
@media only screen and (min-width: $botMinWidth ) and (max-width: $botMinWidth ) {
width: $mobile-landscape-width; } }
@mixin third($num: 1) {
@include column;
width: skeleton-third-width($num, $base-width);
@media only screen and (min-width: $topMinWidth ) and (max-width: $topMaxWidth ) {
width: skeleton-third-width($num, $tablet-width); }
@media only screen and (max-width: $medMinWidth) {
width: $mobile-portrait-width; }
@media only screen and (min-width: $botMinWidth ) and (max-width: $botMaxWidth ) {
width: $mobile-landscape-width; }}
@mixin offset($num: 1) {
$offset: 2 * $margin;
padding-left: skeleton-column-width($num, $base-width) + $offset;
@media only screen and (min-width: $botMaxWidth ) and (max-width: $topMaxWidth ) {
padding-left: skeleton-column-width($num, $tablet-width) + $offset; }
@media only screen and (max-width: $medMaxWidth ) {
padding-left: 0; } }
/* #Clearing
================================================== */
/* Include clearfix on parent to clear nested columns,
or wrap each row of columns in a @include row */
@mixin clearfix {
zoom: 1;
&:after { clear: both; }
&:before, &:after {
content: '\0020';
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0; } }
/* You can also use a @include clear to clear columns */
@mixin clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0; }