| OLD | NEW | 
|---|
| 1 * { | 1 * { | 
| 2   box-sizing: border-box; | 2   box-sizing: border-box; | 
| 3 } | 3 } | 
| 4 | 4 | 
| 5 body { | 5 body { | 
| 6   background: grey; | 6   background: grey; | 
| 7   padding: 0; | 7   padding: 0; | 
| 8   margin: 0; | 8   margin: 0; | 
| 9 } | 9 } | 
| 10 | 10 | 
| 11 h2 { | 11 h2 { | 
| 12   font-size: 30px; | 12   font-size: 26px; | 
| 13 } | 13 } | 
| 14 | 14 | 
| 15 p { | 15 p { | 
| 16   margin: 0 0 10px; | 16   margin: 0 0 10px; | 
| 17   padding: 0; | 17   padding: 0; | 
| 18 } | 18 } | 
| 19 | 19 | 
| 20 .card-group { | 20 .card-group { | 
| 21   padding: 30px; | 21   padding: 30px; | 
|  | 22   width: 100%; | 
| 22 } | 23 } | 
| 23 | 24 | 
| 24 .card { | 25 .card { | 
| 25   background: #fff; | 26   background: #fff; | 
| 26   border: 1px solid black; | 27   border: 1px solid black; | 
| 27 } | 28 } | 
| 28 | 29 | 
| 29 | 30 | 
| 30 // Note: With both solutions, I use a fixed header height | 31 // Note: With both solutions, I use a fixed header height | 
| 31 $card__header--height: 100px; | 32 $card__header--height: 100px; | 
| 32 | 33 | 
| 33 .card__header { | 34 .card__header { | 
| 34   height: $card__header--height; | 35   height: $card__header--height; | 
| 35   margin-bottom: 20px; | 36   margin-bottom: 20px; | 
| 36   border: 2px solid plum; | 37   border: 2px solid plum; | 
| 37 } | 38 } | 
| 38 | 39 | 
| 39 .card__content { | 40 .card__content { | 
| 40   border: 2px solid cornflowerblue; | 41   border: 2px solid cornflowerblue; | 
| 41 } | 42 } | 
| 42 .card__footer { | 43 .card__footer { | 
| 43   border: 2px solid lightcoral; | 44   border: 2px solid lightcoral; | 
| 44 } | 45 } | 
| 45 | 46 | 
| 46 | 47 | 
| 47 | 48 | 
| 48 | 49 | 
| 49 /* Table Layout Fallback | 50 /* Float Layout Fallback | 
| 50  * Note - requires a set height for the .card__footer | 51  * Note - requires a set height for the .card__footer and .card__content | 
| 51  */ | 52  */ | 
| 52 | 53 | 
| 53 $card__footer--height: 30px; | 54 $card__footer--height: 30px; | 
|  | 55 $card__content--height: 180px; | 
| 54 | 56 | 
| 55 .card-group { | 57 .card-group:after { | 
|  | 58   clear: both; | 
|  | 59   content: ""; | 
| 56   display: table; | 60   display: table; | 
| 57 } | 61 } | 
| 58 | 62 | 
| 59 .card { | 63 .card { | 
| 60   display: table-cell; | 64 | 
| 61   position: relative; | 65   position: relative; | 
|  | 66   width: 100%; | 
| 62 | 67 | 
| 63   width: 100%; | 68   @media (min-width: 600px) { | 
| 64   @media (min-width: 600px) { width: 50%; } | 69     width: 50%; | 
| 65   @media (min-width: 800px) { width: 33%; } | 70     float: left; | 
|  | 71    } | 
|  | 72 | 
|  | 73   @media (min-width: 800px) { | 
|  | 74     width: 33%; | 
|  | 75    } | 
| 66 } | 76 } | 
| 67 | 77 | 
| 68 .card__content { | 78 .card__content { | 
| 69   margin-bottom: $card__footer--height + 20px; | 79   margin-bottom: $card__footer--height + 20px; | 
|  | 80 | 
|  | 81   @media (min-width: 600px) { | 
|  | 82     height: $card__content--height; | 
|  | 83   } | 
| 70 } | 84 } | 
| 71 | 85 | 
| 72 .card__footer { | 86 .card__footer { | 
| 73   height: $card__footer--height; | 87   height: $card__footer--height; | 
| 74   width: 100%; | 88   width: 100%; | 
| 75   position: absolute; | 89   position: absolute; | 
| 76   left: 0; | 90   left: 0; | 
| 77   bottom: 0; | 91   bottom: 0; | 
| 78 } | 92 } | 
| 79 | 93 | 
| 80 | 94 | 
| 81 | 95 | 
| 82 /* Grid Layout Enhancement | 96 /* Grid Layout Enhancement | 
| 83  * | 97  * Note - Only requires set height for the .card__header, and a max width for ea
     ch .card | 
| 84  */ | 98  */ | 
| 85 $card--max-width: 300px; | 99 $card--max-width: 300px; | 
| 86 | 100 | 
| 87 @supports (display: grid) { | 101 @supports not (display: grid) { | 
| 88 | 102 | 
| 89   .card-group { | 103   .card-group { | 
| 90     display: grid; | 104     display: grid; | 
| 91     grid-template-columns: repeat(auto-fit, minmax($card--max-width, 1fr)) | 105     grid-template-columns: repeat(auto-fit, minmax($card--max-width, 1fr)) | 
| 92   } | 106   } | 
| 93 | 107 | 
| 94   .card { | 108   .card { | 
| 95     display: inline-grid; | 109     display: inline-grid; | 
| 96     grid-template-rows: minmax($card__header--height, auto) 1fr auto; | 110     grid-template-rows: minmax($card__header--height, auto) 1fr auto; | 
| 97     @media all { width: 100%; } | 111 | 
|  | 112     @media all { | 
|  | 113       width: 100%; | 
|  | 114       float: none; | 
|  | 115     } | 
| 98   } | 116   } | 
| 99 | 117 | 
| 100   .card__content { | 118   .card__content { | 
| 101     margin-bottom: 20px; | 119     margin-bottom: 20px; | 
|  | 120     height: auto; | 
| 102   } | 121   } | 
| 103 | 122 | 
| 104   .card__footer { | 123   .card__footer { | 
| 105     position: relative; | 124     position: relative; | 
| 106     height: auto; | 125     height: auto; | 
| 107   } | 126   } | 
| 108 | 127 | 
| 109 } | 128 } | 
| OLD | NEW | 
|---|