responsive.less 5.53 KB
Newer Older
1
2
3
// Responsive.less
// For phone and tablet devices
// -------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
4
5


6
7
8
9
10
11
12
13
14
15
16
// RESPONSIVE CLASSES
// ------------------

// Hide from screenreaders and browsers
// Credit: HTML5BP
.hidden {
  display: none;
  visibility: hidden;
}


17
18
19
// UP TO LANDSCAPE PHONE
// ---------------------

Mark Otto's avatar
Mark Otto committed
20
@media (max-width: 480px) {
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

  // Make the nav work for small devices
  .navbar {
    .nav {
      position: absolute;
      top: 0;
      left: 0;
      width: 180px;
      padding-top: 40px;
      list-style: none;
    }
    .nav,
    .nav > li:last-child a {
      .border-radius(0 0 4px 0);
    }
    .nav > li {
      float: none;
      display: none;
    }
    .nav > li > a {
      float: none;
      background-color: #222;
    }
    .nav > .active {
      display: block;
      position: absolute;
      top: 0;
      left: 0;
    }
    .nav > .active > a {
      background-color: transparent;
    }
    .nav > .active > a:hover {
      background-color: #333;
    }
    .nav > .active > a:after {
      display: inline-block;
      width: 0;
      height: 0;
      margin-top: 8px;
      margin-left: 6px;
      text-indent: -99999px;
      vertical-align: top;
      border-left: 4px solid transparent;
      border-right: 4px solid transparent;
      border-top: 4px solid @white;
      .opacity(100);
      content: "↓";
    }
    .nav:hover > li {
      display: block;
    }
    .nav:hover > li > a:hover {
      background-color: #333;
    }
  }

78
  // Remove the horizontal form styles
79
  .horizontal-form .control-group > label {
80
81
82
83
84
85
    float: none;
    width: auto;
    padding-top: 0;
    text-align: left;
  }
  // Move over all input controls and content
86
  .horizontal-form .controls {
87
88
89
    margin-left: 0;
  }
  // Move the options list down to align with labels
90
  .horizontal-form .control-list {
91
    padding-top: 0; // has to be padding because margin collaspes
Mark Otto's avatar
Mark Otto committed
92
  }
93
  // Move over buttons in .form-actions to align with .controls
94
  .horizontal-form .form-actions {
95
96
    padding-left: 0;
  }
97
98
99
100
101
102
103
104

  // Modals
  .modal {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    width: auto;
105
    &.fade.in { top: auto; }
106
  }
107
108
109
110
  .modal-header .close {
    padding: 10px;
  }

Mark Otto's avatar
Mark Otto committed
111
112
113
}


114
115
116
// LANDSCAPE PHONE TO SMALL DESKTOP & PORTRAIT TABLET
// --------------------------------------------------

117
@media (max-width: 768px) {
118
119
120
121
122
123
124
125
126
  
  // Unfix the navbar
  .navbar-fixed {
    position: absolute;
  }
  .navbar-fixed .nav {
    float: none;
  }

Mark Otto's avatar
Mark Otto committed
127
128
129
  // Remove width from containers
  .container {
    width: auto;
130
    padding: 0 20px;
Mark Otto's avatar
Mark Otto committed
131
  }
132
133
134
135
  // Undo negative margin on rows
  .row {
    margin-left: 0;
  }
Mark Otto's avatar
Mark Otto committed
136
  // Make all columns even
137
  .row > [class*="span"] {
Mark Otto's avatar
Mark Otto committed
138
139
140
141
142
    float: none;
    display: block;
    width: auto;
    margin: 0;
  }
143

Mark Otto's avatar
Mark Otto committed
144
145
146
}


147
148
// PORTRAIT TABLET TO DEFAULT DESKTOP
// ----------------------------------
Mark Otto's avatar
Mark Otto committed
149
150
151
152
153

@media (min-width: 768px) and (max-width: 940px) {

  // Reset grid variables
  @gridColumns:       16;
154
  @gridColumnWidth:   44px;
Mark Otto's avatar
Mark Otto committed
155
156
157
158
159
160
161
162
  @gridGutterWidth:   20px;
  @siteWidth:         748px;

  // Bring grid mixins to recalculate widths
  .columns(@columnSpan: 1) {
    width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1));
  }
  .offset(@columnOffset: 1) {
163
    margin-left: (@gridColumnWidth * @columnOffset) + (@gridGutterWidth * (@columnOffset - 1)) + @gridGutterWidth;
Mark Otto's avatar
Mark Otto committed
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
  }

  // 16cols at 30px wide with 16px gutters
  .container {
    width: @siteWidth;
  }

  // Default columns
  .span1     { .columns(1); }
  .span2     { .columns(2); }
  .span3     { .columns(3); }
  .span4     { .columns(4); }
  .span5     { .columns(5); }
  .span6     { .columns(6); }
  .span7     { .columns(7); }
  .span8     { .columns(8); }
  .span9     { .columns(9); }
  .span10    { .columns(10); }
  .span11    { .columns(11); }
  .span12    { .columns(12); }

  // Offset column options
  .offset1   { .offset(1); }
  .offset2   { .offset(2); }
  .offset3   { .offset(3); }
  .offset4   { .offset(4); }
  .offset5   { .offset(5); }
  .offset6   { .offset(6); }
  .offset7   { .offset(7); }
  .offset8   { .offset(8); }
  .offset9   { .offset(9); }
  .offset10  { .offset(10); }
  .offset11  { .offset(11); }
  .offset12  { .offset(12); }

}

201
202
// LARGE DESKTOP & UP
// ------------------
Mark Otto's avatar
Mark Otto committed
203
/*
204
@media (min-width: 1210px) {
Mark Otto's avatar
Mark Otto committed
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222

  // Reset grid variables
  @gridColumns:       12;
  @gridColumnWidth:   70px;
  @gridGutterWidth:   30px;
  @siteWidth:         1170px;

  // Bring grid mixins to recalculate widths
  .columns(@columnSpan: 1) {
    width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1));
  }
  .offset(@columnOffset: 1) {
    margin-left: (@gridColumnWidth * @columnOffset) + (@gridGutterWidth * (@columnOffset - 1)) + @gridGutterWidth;
  }

  .container {
    width: @siteWidth;
  }
223
224
225
  .row {
    margin-left: @gridGutterWidth * -1;
  }
Mark Otto's avatar
Mark Otto committed
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
  [class*="span"] {
    margin-left: @gridGutterWidth;
  }

  // Default columns
  .span1     { .columns(1); }
  .span2     { .columns(2); }
  .span3     { .columns(3); }
  .span4     { .columns(4); }
  .span5     { .columns(5); }
  .span6     { .columns(6); }
  .span7     { .columns(7); }
  .span8     { .columns(8); }
  .span9     { .columns(9); }
  .span10    { .columns(10); }
  .span11    { .columns(11); }
  .span12    { .columns(12); }

  // Offset column options
  .offset1   { .offset(1); }
  .offset2   { .offset(2); }
  .offset3   { .offset(3); }
  .offset4   { .offset(4); }
  .offset5   { .offset(5); }
  .offset6   { .offset(6); }
  .offset7   { .offset(7); }
  .offset8   { .offset(8); }
  .offset9   { .offset(9); }
  .offset10  { .offset(10); }
  .offset11  { .offset(11); }
  .offset12  { .offset(12); }

Mark Otto's avatar
Mark Otto committed
258
}
259
*/