Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit a4a4a45

Browse files
SplaktarThomasBurleson
authored andcommitted
fix(layout): fix wrapping and filling layouts to 100% using flex-33 or flex-66
Use calc() to determine 33% and 66% so that browser will properly add them together to make 100%. * Remove flex-34 and flex-67. * Update docs for these changes. Fixes #5346. Closes #5348.
1 parent 309cef5 commit a4a4a45

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed

docs/app/partials/layout-grid.tmpl.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
<div flex="33">
4242
[flex="33"]
4343
</div>
44-
<div flex="67">
45-
[flex="67"]
44+
<div flex="66">
45+
[flex="66"]
4646
</div>
4747
<div flex="50">
4848
[flex="50"]
@@ -58,9 +58,9 @@
5858
A layout child's <code>flex</code> attribute can be given an integer value from 0-100.
5959
The element will stretch to the percentage of available space matching the value.
6060
<br/><br/>
61-
Currently, the <code>flex</code> attribute value is restricted to multiples of five and 33, 34, 66, and 67.
61+
Currently, the <code>flex</code> attribute value is restricted to multiples of five and 33 or 66.
6262
<br/>
63-
For example: <code>flex="5", flex="20", flex="33", flex="50", flex="67", flex="75", ... flex="100"</code>.
63+
For example: <code>flex="5", flex="20", flex="33", flex="50", flex="66", flex="75", ... flex="100"</code>.
6464
</p>
6565
<p>
6666
See the <a href="layout/options">layout options page</a> for more information on responsive flex attributes like
@@ -193,7 +193,7 @@
193193
<p>
194194
Add the <code>flex-offset</code> attribute to a layout child to set its
195195
offset percentage within the layout. Values must be multiples
196-
of <code>5</code>, or <code>33</code>, <code>34</code>, <code>66</code>, <code>67</code>.
196+
of <code>5</code> or <code>33</code> / <code>66</code>.
197197
</p>
198198
<table class="md-api-table">
199199
<tr>

docs/app/partials/layout-options.tmpl.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@
8888
<demo-file name="index.html">
8989
<div layout="row" layout-wrap>
9090
<div flex="33">[flex=33]</div>
91-
<div flex="67">[flex=67]</div>
92-
<div flex="67">[flex=67]</div>
91+
<div flex="66">[flex=66]</div>
92+
<div flex="66">[flex=66]</div>
93+
<div flex="33">[flex=33]</div>
9394
<div flex="33">[flex=33]</div>
9495
<div flex="33">[flex=33]</div>
95-
<div flex="34">[flex=34]</div>
9696
<div flex="33">[flex=33]</div>
9797
</div>
9898
</demo-file>
@@ -109,10 +109,10 @@
109109
<docs-demo demo-title="Responsive Flex Attributes" class="small-demo colorNested-noPad">
110110
<demo-file name="index.html">
111111
<div layout="row">
112-
<div flex="67" flex-sm="33">
112+
<div flex="66" flex-sm="33">
113113
I flex to one-third of the space on mobile, and two-thirds on other devices.
114114
</div>
115-
<div flex="33" flex-sm="67">
115+
<div flex="33" flex-sm="66">
116116
I flex to two-thirds of the space on mobile, and one-third on other devices.
117117
</div>
118118
</div>

src/core/services/layout/layout.scss

+8-12
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
}
6767
}
6868

69-
@each $i in 33, 34 {
69+
@each $i in 33 {
7070
$offsets : '';
7171
$suffix : '';
7272

@@ -78,11 +78,11 @@
7878
}
7979

8080
#{$offsets} {
81-
margin-left: #{$i+'%'};
81+
margin-left: calc(100% / 3);
8282
}
8383
}
8484

85-
@each $i in 66, 67 {
85+
@each $i in 66 {
8686
$offsets : '';
8787
$suffix : '';
8888

@@ -94,7 +94,7 @@
9494
}
9595

9696
#{$offsets} {
97-
margin-left: #{$i+'%'};
97+
margin-left: calc(200% / 3);
9898
}
9999
}
100100
}
@@ -159,16 +159,12 @@
159159
}
160160

161161
.layout-row, .layout#{$name}-row {
162-
> .#{$flexName}-33 , > .#{$flexName}-33 { flex: 1 1 33%; max-width: 33%; max-height: 100%; box-sizing: border-box; }
163-
> .#{$flexName}-34 , > .#{$flexName}-34 { flex: 1 1 34%; max-width: 34%; max-height: 100%; box-sizing: border-box; }
164-
> .#{$flexName}-66 , > .#{$flexName}-66 { flex: 1 1 66%; max-width: 66%; max-height: 100%; box-sizing: border-box; }
165-
> .#{$flexName}-67 , > .#{$flexName}-67 { flex: 1 1 67%; max-width: 67%; max-height: 100%; box-sizing: border-box; }
162+
> .#{$flexName}-33 , > .#{$flexName}-33 { flex: 1 1 33%; max-width: calc(100% / 3); max-height: 100%; box-sizing: border-box; }
163+
> .#{$flexName}-66 , > .#{$flexName}-66 { flex: 1 1 66%; max-width: calc(200% / 3); max-height: 100%; box-sizing: border-box; }
166164
}
167165
.layout-column, .layout#{$name}-column {
168-
> .#{$flexName}-33 , > .#{$flexName}-33 { flex: 1 1 33%; max-width: 100%; max-height: 33%; box-sizing: border-box; }
169-
> .#{$flexName}-34 , > .#{$flexName}-34 { flex: 1 1 34%; max-width: 100%; max-height: 34%; box-sizing: border-box; }
170-
> .#{$flexName}-66 , > .#{$flexName}-66 { flex: 1 1 66%; max-width: 100%; max-height: 66%; box-sizing: border-box; }
171-
> .#{$flexName}-67 , > .#{$flexName}-67 { flex: 1 1 67%; max-width: 100%; max-height: 67%; box-sizing: border-box; }
166+
> .#{$flexName}-33 , > .#{$flexName}-33 { flex: 1 1 33%; max-width: 100%; max-height: calc(100% / 3); box-sizing: border-box; }
167+
> .#{$flexName}-66 , > .#{$flexName}-66 { flex: 1 1 66%; max-width: 100%; max-height: calc(200% / 3); box-sizing: border-box; }
172168
}
173169
}
174170

0 commit comments

Comments
 (0)