-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommon.scss
86 lines (76 loc) · 2.09 KB
/
common.scss
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
78
79
80
81
82
83
84
85
86
// Utilities : Paddings, Margins
$spaces: (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
$sides: (top, right, bottom, left);
// Bootstrap utility classes:
// p-0: [padding: 0rem]
// ml-0: [margin-left: 0rem]
// pl-1 : [ padding-left: 0.25rem ]
// mr-2 : [ margin-right: 0.5rem ]
// pt-3 : [ padding-top: 0.75rem ]
// mb-4 : [ margin-bottom: 1rem ]
// pl-5 : [ padding-left: 1.25rem ]
// mr-6 : [ margin-right: 1.5rem ]
// pt-7 : [ padding-top: 1.75rem ]
// mb-8 : [ margin-bottom: 2rem ]
@each $space in $spaces {
.m-#{$space} {
margin: #{$space/4}rem;
}
.p-#{$space} {
padding: #{$space/4}rem;
}
@each $side in $sides {
.m#{str-slice($side, 0, 1)}-#{$space} {
margin-#{$side}: #{$space/4}rem !important;
}
.p#{str-slice($side, 0, 1)}-#{$space} {
padding-#{$side}: #{$space/4}rem !important;
}
}
}
// Bootstrap style of row, cols spacing ( Every row contains 12 columns )
// Large screen: .col-lg-#{space}
// Medium screen: col-md-#{space}
// Small screen: col-sm-#{space}
// Extremely small screen: col-xs-#{space}
// Utilization
// <div class="row">
// <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12"></div>
// <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12"></div>
// <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12"></div>
// <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12"></div>
// </div>
.row {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
$cols: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
@media only screen and (max-width: 600px) {
@each $col in $cols {
.col-xs-#{$col} {
flex: #{$col} 0 calc(100% / 12 * #{$col});
}
}
}
@media only screen and (min-width: 600px) {
@each $col in $cols {
.col-sm-#{$col} {
flex: #{$col} 0 calc(100% / 12 * #{$col});
}
}
}
@media only screen and (min-width: 768px) and (max-width: 1200px) {
@each $col in $cols {
.col-md-#{$col} {
flex: #{$col} 0 calc(100% / 12 * #{$col});
}
}
}
@media only screen and (min-width: 1200px) {
@each $col in $cols {
.col-lg-#{$col} {
flex: #{$col} 0 calc(100% / 12 * #{$col});
}
}
}