forked from bobbigmac/css-masonry
/
css-masonry.css
77 lines (75 loc) · 1.62 KB
/
css-masonry.css
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
/* Based off http://w3bits.com/css-masonry/ */
/* Should be pretty well supported: http://caniuse.com/#feat=multicolumn */
.masonry-wall { /* Masonry container */
column-count: 1;
-webkit-column-count: 1;
-moz-column-count: 1;
column-gap: 1em;
-webkit-column-gap: 1em;
-moz-column-gap: 1em;
}
.masonry-brick { /* Masonry bricks or child elements */
display: inline-block;
width: 100%;
}
.masonry-brick.masonry-no-break {
/*
fixes breaking mid-content (chrome changed in 45).
Not sure how much of a bodge this is. PRs welcome if you have a better solution.
*/
display: table;
-webkit-column-break-inside:avoid;
-moz-column-break-inside:avoid;
column-break-inside:avoid;
}
@media only screen and (min-width: 768px) {
.masonry-wall {
column-count: 2;
-webkit-column-count: 2;
-moz-column-count: 2;
}
.masonry-cap-1 {
column-count: 1;
-webkit-column-count: 1;
-moz-column-count: 1;
}
}
@media only screen and (min-width: 992px) {
.masonry-wall {
column-count: 3;
-webkit-column-count: 3;
-moz-column-count: 3;
}
.masonry-cap-1 {
column-count: 1;
-webkit-column-count: 1;
-moz-column-count: 1;
}
.masonry-cap-2 {
column-count: 2;
-webkit-column-count: 2;
-moz-column-count: 2;
}
}
@media only screen and (min-width: 1200px) {
.masonry-wall {
column-count: 4;
-webkit-column-count: 4;
-moz-column-count: 4;
}
.masonry-cap-1 {
column-count: 1;
-webkit-column-count: 1;
-moz-column-count: 1;
}
.masonry-cap-2 {
column-count: 2;
-webkit-column-count: 2;
-moz-column-count: 2;
}
.masonry-cap-3 {
column-count: 3;
-webkit-column-count: 3;
-moz-column-count: 3;
}
}