Project

General

Profile

Download (5.42 KB) Statistics
| Branch: | Tag: | Revision:
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; /* Move all the children of #main down to make room. */
83
    padding-bottom: $zen-gutter-width;
84
    position: relative;
85
  }
86
  #navigation {
87
    position: absolute;
88
    top: 0; /* Move the navbar up inside #main's padding. */
89
    height: $menu-bar-line-height * 2;
90
    width: $zen-grid-width;
91
  }
92
}
93

    
94
@media all and (min-width: 480px) and (max-width: 959px) {
95
  /*
96
   * Use 3 grid columns for smaller screens.
97
   */
98
  $zen-column-count: 3;
99

    
100
  /*
101
   * The layout when there is only one sidebar, the left one.
102
   */
103

    
104
  .sidebar-first {
105
    #content { /* Span 2 columns, starting in 2nd column from left. */
106
      @include zen-grid-item(2, 2);
107
    }
108

    
109
    .region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
110
      @include zen-grid-item(1, 1);
111
    }
112
  }
113

    
114
  /*
115
   * The layout when there is only one sidebar, the right one.
116
   */
117

    
118
  .sidebar-second {
119
    #content { /* Span 2 columns, starting in 1st column from left. */
120
      @include zen-grid-item(2, 1);
121
    }
122

    
123
    .region-sidebar-second { /* Span 1 column, starting in 3rd column from left. */
124
      @include zen-grid-item(1, 3);
125
    }
126
  }
127

    
128
  /*
129
   * The layout when there are two sidebars.
130
   */
131

    
132
  .two-sidebars {
133
    #content { /* Span 2 columns, starting in 2nd column from left. */
134
      @include zen-grid-item(2, 2);
135
    }
136

    
137
    .region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
138
      @include zen-grid-item(1, 1);
139
    }
140

    
141
    .region-sidebar-second { /* Start a new row and span all 3 columns. */
142
      @include zen-grid-item(3, 1);
143
      @include zen-nested-container(); // Since we're making every block in this region be a grid item.
144
      @include zen-clear();
145

    
146
      .block {
147
        @include zen-grid-item-base();
148
      }
149
      .block:nth-child(3n+1) { /* Span 1 column, starting in the 1st column from left. */
150
        @include zen-grid-item(1, 1);
151
        @include zen-clear();
152
      }
153
      .block:nth-child(3n+2) { /* Span 1 column, starting in the 2nd column from left. */
154
        @include zen-grid-item(1, 2);
155
      }
156
      .block:nth-child(3n) { /* Span 1 column, starting in the 3rd column from left. */
157
        @include zen-grid-item(1, 3);
158
      }
159
    }
160
  }
161
}
162

    
163
@media all and (min-width: 960px) {
164
  /*
165
   * Use 5 grid columns for larger screens.
166
   */
167
  $zen-column-count: 4;
168

    
169
  /*
170
   * The layout when there is only one sidebar, the left one.
171
   */
172

    
173
  .sidebar-first {
174
    #content { /* Span 4 columns, starting in 2nd column from left. */
175
      @include zen-grid-item(3, 2);
176
    }
177

    
178
    .region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
179
      @include zen-grid-item(1, 1);
180
    }
181
  }
182

    
183
  /*
184
   * The layout when there is only one sidebar, the right one.
185
   */
186

    
187
  .sidebar-second {
188
    #content { /* Span 4 columns, starting in 1st column from left. */
189
      @include zen-grid-item(3, 1);
190
    }
191

    
192
    .region-sidebar-second { /* Span 1 column, starting in 5th column from left. */
193
      @include zen-grid-item(1, 4);
194
    }
195
  }
196

    
197
  /*
198
   * The layout when there are two sidebars.
199
   */
200

    
201
  .two-sidebars {
202
    #content { /* Span 3 columns, starting in 2nd column from left. */
203
      @include zen-grid-item(2, 2);
204
    }
205

    
206
    .region-sidebar-first { /* Span 1 column, starting in 1st column from left. */
207
      @include zen-grid-item(1, 1);
208
    }
209

    
210
    .region-sidebar-second { /* Span 1 column, starting in 5th column from left. */
211
      @include zen-grid-item(1, 4);
212
    }
213
  }
214
}
(4-4/4)