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


6
7
8
// UP TO LANDSCAPE PHONE
// ---------------------

Mark Otto's avatar
Mark Otto committed
9
10
11
12
13
14
15
16
17
18
19
@media (max-width: 480px) {
  // Remove width from containers
  .container {
    width: auto;
    padding: 0 10px;
  }
  // Make all columns even
  [class*="span"] {
    float: none;
    display: block;
    width: auto;
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    margin: 0;
  }
  // Resize modals
  .modal {
    width: auto;
    margin: 0;
  }

  // Remove the horizontal form styles
  .form-horizontal .control-group > label {
    float: none;
    width: auto;
    padding-top: 0;
    text-align: left;
  }
  // Move over all input controls and content
  .form-horizontal .controls {
    margin-left: 0;
  }
  // Move the options list down to align with labels
  .form-horizontal .control-list {
    padding-top: 0; // has to be padding because margin collaspes
Mark Otto's avatar
Mark Otto committed
42
  }
43
44
45
46
47
  // Move over buttons in .form-actions to align with .controls
  .form-horizontal .form-actions {
    padding-left: 0;
  }

Mark Otto's avatar
Mark Otto committed
48
49
50
}


51
52
53
// LANDSCAPE PHONE TO SMALL DESKTOP & PORTRAIT TABLET
// --------------------------------------------------

Mark Otto's avatar
Mark Otto committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@media (min-width: 480px) and (max-width: 768px) {
  // Remove width from containers
  .container {
    width: auto;
    padding: 0 10px;
  }
  // Make all columns even
  [class*="span"] {
    float: none;
    display: block;
    width: auto;
    margin: 0;
  }
}


70
71
// PORTRAIT TABLET TO DEFAULT DESKTOP
// ----------------------------------
Mark Otto's avatar
Mark Otto committed
72
73
74
75
76

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

  // Reset grid variables
  @gridColumns:       16;
77
  @gridColumnWidth:   44px;
Mark Otto's avatar
Mark Otto committed
78
79
80
81
82
83
84
85
  @gridGutterWidth:   20px;
  @siteWidth:         748px;

  // Bring grid mixins to recalculate widths
  .columns(@columnSpan: 1) {
    width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1));
  }
  .offset(@columnOffset: 1) {
86
    margin-left: (@gridColumnWidth * @columnOffset) + (@gridGutterWidth * (@columnOffset - 1)) + @gridGutterWidth;
Mark Otto's avatar
Mark Otto committed
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
  }

  // 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); }

}

124
125
// LARGE DESKTOP & UP
// ------------------
Mark Otto's avatar
Mark Otto committed
126

127
@media (min-width: 1210px) {
Mark Otto's avatar
Mark Otto committed
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177

  // 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;
  }
  [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
178
}