Skip to content

Commit 08d9aca

Browse files
committed
fix(rtl): rtl float, margin and padding
1 parent 0e98b7b commit 08d9aca

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

scss/_rtl.scss

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// stylelint-disable declaration-no-important
12
//
23
// RTL Support
34
//
@@ -9,7 +10,6 @@
910
text-align: right;
1011
}
1112

12-
1313
// Dropdown
1414
.dropdown-item {
1515
text-align: right;
@@ -24,4 +24,61 @@
2424
left: 10px;
2525
}
2626
}
27+
28+
// Float
29+
.float-left {
30+
float: right !important;
31+
}
32+
.float-right {
33+
float: left !important;
34+
}
35+
36+
// Margin and Padding
37+
@each $breakpoint in map-keys($grid-breakpoints) {
38+
@include media-breakpoint-up($breakpoint) {
39+
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
40+
41+
@each $prop, $abbrev in (margin: m, padding: p) {
42+
@each $size, $length in $spacers {
43+
.#{$abbrev}r#{$infix}-#{$size},
44+
.#{$abbrev}x#{$infix}-#{$size} {
45+
#{$prop}-right: 0 !important;
46+
#{$prop}-left: $length !important;
47+
}
48+
.#{$abbrev}l#{$infix}-#{$size},
49+
.#{$abbrev}x#{$infix}-#{$size} {
50+
#{$prop}-right: $length !important;
51+
#{$prop}-left: 0 !important;
52+
}
53+
}
54+
}
55+
56+
// Negative margins (e.g., where `.mb-n1` is negative version of `.mb-1`)
57+
@each $size, $length in $spacers {
58+
@if $size != 0 {
59+
.mr#{$infix}-n#{$size},
60+
.mx#{$infix}-n#{$size} {
61+
margin-right: 0 !important;
62+
margin-left: -$length !important;
63+
}
64+
.ml#{$infix}-n#{$size},
65+
.mx#{$infix}-n#{$size} {
66+
margin-right: -$length !important;
67+
margin-left: 0 !important;
68+
}
69+
}
70+
}
71+
72+
// Some special margin utils
73+
.mr#{$infix}-auto,
74+
.mx#{$infix}-auto {
75+
margin-left: auto !important;
76+
}
77+
.ml#{$infix}-auto,
78+
.mx#{$infix}-auto {
79+
margin-right: auto !important;
80+
}
81+
}
82+
}
83+
2784
}

0 commit comments

Comments
 (0)