Skip to content

Commit 45193b8

Browse files
committed
[1]: Fix IE11 flex shorthand bug with card and cardGroup.
1 parent a455706 commit 45193b8

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

dist/styles.css

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@
487487
/**
488488
* We're going to lay out this element's children
489489
* just like in the "Centered prompt" example.
490-
* First we'll rotate the main axis so that the
490+
* First we'll rotate the main axis so that the
491491
* children are laid out vertically.
492492
*/
493493
-webkit-flex-direction: column;
@@ -512,7 +512,7 @@
512512
-ms-flex-pack: center;
513513
justify-content: center;
514514

515-
padding: 15px;
515+
padding: 15px 0;
516516
}
517517

518518
.card__descriptionIcon {
@@ -524,6 +524,7 @@
524524
color: #57727C;
525525
font-size: 12px;
526526
text-align: center;
527+
max-width: calc(100% - 30px);
527528
}
528529

529530
.card__price {
@@ -539,6 +540,7 @@
539540
.card--fixedWidth {
540541
max-width: 120px;
541542
}
543+
542544
/*=====================================================
543545
contents of: index.css
544546
=====================================================*/
@@ -566,13 +568,13 @@
566568
* properties. These properties control how the
567569
* element resizes to fill its container.
568570
*
569-
* We'll also set flex-grow to 1 so that it
570-
* will expand to fill its container. (The
571+
* We'll set flex-grow to 1 so that it will
572+
* expand to fill its container. (The default
571573
* default value is 0.)
572574
*
573-
* We'll set flex-shrink to 1 so that the element
574-
* will shrink as its container gets smaller.
575-
* (The default value is 1.)
575+
* We'll also set flex-shrink to 1 so that the
576+
* element will shrink as its container gets
577+
* smaller. (The default value is 1.)
576578
*
577579
* Last, we set flex-basis to 0 so that its
578580
* size is solely determined by the size of
@@ -585,10 +587,16 @@
585587
* shrink with its container and siblings, but
586588
* they will all have the same size, even if they
587589
* have different amounts of content.
590+
*
591+
* NOTE: IE11 ignores flex short-hand declarations
592+
* with unitless flex-basis values. So we have to
593+
* use 0% instead of 0 as a workaround. You can
594+
* find more info at:
595+
* github.com/philipwalton/flexbugs.
588596
*/
589-
-webkit-flex: 1 1 0;
590-
-ms-flex: 1 1 0;
591-
flex: 1 1 0;
597+
-webkit-flex: 1 1 0%;
598+
-ms-flex: 1 1 0%;
599+
flex: 1 1 0%;
592600

593601
border: none;
594602
border-radius: 0;

src/styles/card-group.css

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
* properties. These properties control how the
1818
* element resizes to fill its container.
1919
*
20-
* We'll also set flex-grow to 1 so that it
21-
* will expand to fill its container. (The
20+
* We'll set flex-grow to 1 so that it will
21+
* expand to fill its container. (The default
2222
* default value is 0.)
2323
*
24-
* We'll set flex-shrink to 1 so that the element
25-
* will shrink as its container gets smaller.
26-
* (The default value is 1.)
24+
* We'll also set flex-shrink to 1 so that the
25+
* element will shrink as its container gets
26+
* smaller. (The default value is 1.)
2727
*
2828
* Last, we set flex-basis to 0 so that its
2929
* size is solely determined by the size of
@@ -36,8 +36,14 @@
3636
* shrink with its container and siblings, but
3737
* they will all have the same size, even if they
3838
* have different amounts of content.
39+
*
40+
* NOTE: IE11 ignores flex short-hand declarations
41+
* with unitless flex-basis values. So we have to
42+
* use 0% instead of 0 as a workaround. You can
43+
* find more info at:
44+
* github.com/philipwalton/flexbugs.
3945
*/
40-
flex: 1 1 0;
46+
flex: 1 1 0%;
4147

4248
border: none;
4349
border-radius: 0;

src/styles/card.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* We're going to lay out this element's children
2828
* just like in the "Centered prompt" example.
29-
* First we'll rotate the main axis so that the
29+
* First we'll rotate the main axis so that the
3030
* children are laid out vertically.
3131
*/
3232
flex-direction: column;
@@ -45,7 +45,7 @@
4545
*/
4646
justify-content: center;
4747

48-
padding: 15px;
48+
padding: 15px 0;
4949
}
5050

5151
.card__descriptionIcon {
@@ -57,6 +57,7 @@
5757
color: #57727C;
5858
font-size: 12px;
5959
text-align: center;
60+
max-width: calc(100% - 30px);
6061
}
6162

6263
.card__price {
@@ -71,4 +72,4 @@
7172

7273
.card--fixedWidth {
7374
max-width: 120px;
74-
}
75+
}

0 commit comments

Comments
 (0)