1
|
/**
|
2
|
* @file
|
3
|
* Positioning for responsive layout .
|
4
|
*
|
5
|
* Define CSS classes to create a table-free, 3-column, 2-column, or single
|
6
|
* column layout depending on whether blocks are enabled in the left or right
|
7
|
* columns.
|
8
|
*
|
9
|
* This layout uses the Zen Grids plugin for Compass: http://zengrids.com
|
10
|
*/
|
11
|
|
12
|
@import "base";
|
13
|
|
14
|
|
15
|
// We are going to create a 980px wide, 5 column grid with 20px gutters between
|
16
|
// columns (applied as 10px of left/right padding on each column).
|
17
|
$zen-column-count: 5;
|
18
|
$zen-gutter-width: 40px;
|
19
|
|
20
|
|
21
|
// IE6-7 don't support box-sizing: border-box. We can fix this in 1 of 3 ways:
|
22
|
// - Drop support for IE 6/7. :-) In the _base.scss, set $legacy-support-for-ie6
|
23
|
// and $legacy-support-for-ie7 to false.
|
24
|
// - (Preferred) Install the box-sizing polyfill and set the variable below to
|
25
|
// the absolute path URL to the boxsizing.htc file.
|
26
|
// @see https://github.com/Schepp/box-sizing-polyfill
|
27
|
// $box-sizing-polyfill-path: "/path/to/boxsizing.htc";
|
28
|
// - Use the same CSS unit for grid width and gutter width (use px for both or
|
29
|
// use % for both, etc.) and set the box-sizing variable to content-box.
|
30
|
// $zen-box-sizing: content-box;
|
31
|
|
32
|
|
33
|
// You can generate more efficient CSS if you manually apply the
|
34
|
// zen-grid-item-base mixin to all grid items from within a single ruleset.
|
35
|
$zen-auto-include-item-base: false;
|
36
|
// $zen-auto-include-flow-item-base: false;
|
37
|
|
38
|
|
39
|
/*
|
40
|
* Center the page.
|
41
|
*/
|
42
|
|
43
|
#page,
|
44
|
.region-bottom {
|
45
|
/* For screen sizes larger than 1200px, prevent excessively long lines of text
|
46
|
by setting a max-width. */
|
47
|
margin-left: auto;
|
48
|
margin-right: auto;
|
49
|
max-width: 960px;
|
50
|
}
|
51
|
|
52
|
/*
|
53
|
* Apply the shared properties of grid items in a single, efficient ruleset.
|
54
|
*/
|
55
|
// See the note about $zen-auto-include-item-base above.
|
56
|
|
57
|
#header,
|
58
|
#content,
|
59
|
#navigation,
|
60
|
.region-sidebar-first,
|
61
|
.region-sidebar-second,
|
62
|
#footer {
|
63
|
@include zen-grid-item-base();
|
64
|
}
|
65
|
|
66
|
/*
|
67
|
* Containers for grid items and flow items.
|
68
|
*/
|
69
|
|
70
|
#header,
|
71
|
#main,
|
72
|
#footer {
|
73
|
@include zen-grid-container();
|
74
|
}
|
75
|
|
76
|
/*
|
77
|
* Navigation bar
|
78
|
*/
|
79
|
|
80
|
@media all and (min-width: 480px) {
|
81
|
#main {
|
82
|
padding-top: $menu-bar-line-height + $zen-gutter-width / 2; /* Move all the children of #main down to make room. */
|
83
|
position: relative;
|
84
|
}
|
85
|
#navigation {
|
86
|
position: absolute;
|
87
|
top: 0; /* Move the navbar up inside #main's padding. */
|
88
|
height: $menu-bar-line-height * 2;
|
89
|
width: $zen-grid-width;
|
90
|
}
|
91
|
}
|
92
|
|
93
|
@media all and (min-width: 480px) and (max-width: 959px) {
|
94
|
/*
|
95
|
* Use 3 grid columns for smaller screens.
|
96
|
*/
|
97
|
$zen-column-count: 3;
|
98
|
|
99
|
/*
|
100
|
* The layout when there is only one sidebar, the left one.
|
101
|
*/
|
102
|
|
103
|
.sidebar-first {
|
104
|
#content { /* Span 2 columns, starting in 2nd column from left. */
|
105
|
@include zen-grid-item(2, 2);
|
106
|
}
|
107
|
|
108
|
.region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
|
109
|
@include zen-grid-item(1, 1);
|
110
|
}
|
111
|
}
|
112
|
|
113
|
/*
|
114
|
* The layout when there is only one sidebar, the right one.
|
115
|
*/
|
116
|
|
117
|
.sidebar-second {
|
118
|
#content { /* Span 2 columns, starting in 1st column from left. */
|
119
|
@include zen-grid-item(2, 1);
|
120
|
}
|
121
|
|
122
|
.region-sidebar-second { /* Span 1 column, starting in 3rd column from left. */
|
123
|
@include zen-grid-item(1, 3);
|
124
|
}
|
125
|
}
|
126
|
|
127
|
/*
|
128
|
* The layout when there are two sidebars.
|
129
|
*/
|
130
|
|
131
|
.two-sidebars {
|
132
|
#content { /* Span 2 columns, starting in 2nd column from left. */
|
133
|
@include zen-grid-item(2, 2);
|
134
|
}
|
135
|
|
136
|
.region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
|
137
|
@include zen-grid-item(1, 1);
|
138
|
}
|
139
|
|
140
|
.region-sidebar-second { /* Start a new row and span all 3 columns. */
|
141
|
@include zen-grid-item(3, 1);
|
142
|
@include zen-nested-container(); // Since we're making every block in this region be a grid item.
|
143
|
@include zen-clear();
|
144
|
|
145
|
.block {
|
146
|
@include zen-grid-item-base();
|
147
|
}
|
148
|
.block:nth-child(3n+1) { /* Span 1 column, starting in the 1st column from left. */
|
149
|
@include zen-grid-item(1, 1);
|
150
|
@include zen-clear();
|
151
|
}
|
152
|
.block:nth-child(3n+2) { /* Span 1 column, starting in the 2nd column from left. */
|
153
|
@include zen-grid-item(1, 2);
|
154
|
}
|
155
|
.block:nth-child(3n) { /* Span 1 column, starting in the 3rd column from left. */
|
156
|
@include zen-grid-item(1, 3);
|
157
|
}
|
158
|
}
|
159
|
}
|
160
|
}
|
161
|
|
162
|
@media all and (min-width: 960px) {
|
163
|
/*
|
164
|
* Use 5 grid columns for larger screens.
|
165
|
*/
|
166
|
$zen-column-count: 4;
|
167
|
|
168
|
/*
|
169
|
* The layout when there is only one sidebar, the left one.
|
170
|
*/
|
171
|
|
172
|
.sidebar-first {
|
173
|
#content { /* Span 4 columns, starting in 2nd column from left. */
|
174
|
@include zen-grid-item(3, 2);
|
175
|
}
|
176
|
|
177
|
.region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
|
178
|
@include zen-grid-item(1, 1);
|
179
|
}
|
180
|
}
|
181
|
|
182
|
/*
|
183
|
* The layout when there is only one sidebar, the right one.
|
184
|
*/
|
185
|
|
186
|
.sidebar-second {
|
187
|
#content { /* Span 4 columns, starting in 1st column from left. */
|
188
|
@include zen-grid-item(3, 1);
|
189
|
}
|
190
|
|
191
|
.region-sidebar-second { /* Span 1 column, starting in 5th column from left. */
|
192
|
@include zen-grid-item(1, 4);
|
193
|
}
|
194
|
}
|
195
|
|
196
|
/*
|
197
|
* The layout when there are two sidebars.
|
198
|
*/
|
199
|
|
200
|
.two-sidebars {
|
201
|
#content { /* Span 3 columns, starting in 2nd column from left. */
|
202
|
@include zen-grid-item(2, 2);
|
203
|
}
|
204
|
|
205
|
.region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
|
206
|
@include zen-grid-item(1, 1);
|
207
|
}
|
208
|
|
209
|
.region-sidebar-second { /* Span 1 column, starting in 5th column from left. */
|
210
|
@include zen-grid-item(1, 4);
|
211
|
}
|
212
|
}
|
213
|
}
|