Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>
Refactoring on grid
src/grid.css | 284 ++++++++++++++++++++++++++++++++++++++++++++---------
diff --git a/src/grid.css b/src/grid.css index bc7ee08bb962e207f1d05b39d6a4eb9380c1c1ad..7ff5ee80915b2ed1b8e38dc8ce5ccc23f7f7ccb1 100644 --- a/src/grid.css +++ b/src/grid.css @@ -1,26 +1,3 @@ -:root { - --gutter-width: 16px; - --outer-margin: 32px; - --gutter-compensation: calc((var(--gutter-width) * 0.5) * -1); - --half-gutter-width: calc((var(--gutter-width) * 0.5)); - --xs-min: 0rem; - --sm-min: 576px; - --md-min: 768px; - --lg-min: 992px; - --xl-min: 1200px; -} - -@custom-media --sm-viewport only screen and (min-width: 576px); -@custom-media --md-viewport only screen and (min-width: 768px); -@custom-media --lg-viewport only screen and (min-width: 992px); -@custom-media --xl-viewport only screen and (min-width: 1200px); - -@custom-media --xs-only only screen and (max-width: 575px); -@custom-media --sm-only only screen and (min-width: 576px) and (max-width: 767px); -@custom-media --md-only only screen and (min-width: 768px) and (max-width: 991px); -@custom-media --lg-only only screen and (min-width: 992px) and (max-width: 1199px); -@custom-media --xl-only only screen and (min-width: 1200px); - .container { box-sizing: border-box; margin-left: auto; @@ -30,53 +7,67 @@ padding-left: 8px; } .container-fluid { - padding-right: var(--gutter-width, 16px); - padding-left: var(--gutter-width, 16px); + padding-right: 16px; + padding-left: 16px; } -@media (--sm-viewport) { +@media only screen and (min-width: 576px) { .container { - width: calc(var(--sm-min) - var(--gutter-width)); + width: 560px; max-width: 100%; } } -@media (--md-viewport) { +@media only screen and (min-width: 768px) { .container { - width: calc(var(--md-min) - var(--gutter-width)); + width: 752px; max-width: 100%; } } -@media (--lg-viewport) { +@media only screen and (min-width: 992px) { .container { - width: calc(var(--lg-min) - var(--gutter-width)); + width: 976px; max-width: 100%; } } -@media (--xl-viewport) { +@media only screen and (min-width: 1200px) { .container { - width: calc(var(--xl-min) - var(--gutter-width)); + width: 1184px; max-width: 100%; } } .row { box-sizing: border-box; + display: -webkit-box; + display: -ms-flexbox; display: flex; + -webkit-box-flex: 0; + -ms-flex: 0 1 auto; flex: 0 1 auto; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-direction: row; flex-direction: row; + -ms-flex-wrap: wrap; flex-wrap: wrap; - margin-right: var(--gutter-compensation, -08px); - margin-left: var(--gutter-compensation, -08px); + margin-right: -8px; + margin-left: -8px; } .row.reverse { + -webkit-box-orient: horizontal; + -webkit-box-direction: reverse; + -ms-flex-direction: row-reverse; flex-direction: row-reverse; } .col.reverse { + -webkit-box-orient: vertical; + -webkit-box-direction: reverse; + -ms-flex-direction: column-reverse; flex-direction: column-reverse; } @@ -211,75 +202,93 @@ .col-xl-offset-10, .col-xl-offset-11, .col-xl-offset-12 { box-sizing: border-box; + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; flex: 0 0 auto; + -ms-flex-preferred-size: 100%; flex-basis: 100%; - padding-right: var(--half-gutter-width, 8px); - padding-left: var(--half-gutter-width, 8px); + padding-right: 8px; + padding-left: 8px; max-width: 100%; } .col-xs { + -webkit-box-flex: 1; + -ms-flex-positive: 1; flex-grow: 1; + -ms-flex-preferred-size: 0; flex-basis: 0; max-width: 100%; } .col-xs-1 { + -ms-flex-preferred-size: 8.33333333%; flex-basis: 8.33333333%; max-width: 8.33333333%; } .col-xs-2 { + -ms-flex-preferred-size: 16.66666667%; flex-basis: 16.66666667%; max-width: 16.66666667%; } .col-xs-3 { + -ms-flex-preferred-size: 25%; flex-basis: 25%; max-width: 25%; } .col-xs-4 { + -ms-flex-preferred-size: 33.33333333%; flex-basis: 33.33333333%; max-width: 33.33333333%; } .col-xs-5 { + -ms-flex-preferred-size: 41.66666667%; flex-basis: 41.66666667%; max-width: 41.66666667%; } .col-xs-6 { + -ms-flex-preferred-size: 50%; flex-basis: 50%; max-width: 50%; } .col-xs-7 { + -ms-flex-preferred-size: 58.33333333%; flex-basis: 58.33333333%; max-width: 58.33333333%; } .col-xs-8 { + -ms-flex-preferred-size: 66.66666667%; flex-basis: 66.66666667%; max-width: 66.66666667%; } .col-xs-9 { + -ms-flex-preferred-size: 75%; flex-basis: 75%; max-width: 75%; } .col-xs-10 { + -ms-flex-preferred-size: 83.33333333%; flex-basis: 83.33333333%; max-width: 83.33333333%; } .col-xs-11 { + -ms-flex-preferred-size: 91.66666667%; flex-basis: 91.66666667%; max-width: 91.66666667%; } .col-xs-12 { + -ms-flex-preferred-size: 100%; flex-basis: 100%; max-width: 100%; } @@ -333,115 +342,151 @@ margin-left: 91.66666667%; } .start-xs { + -webkit-box-pack: start; + -ms-flex-pack: start; justify-content: flex-start; text-align: start; } .center-xs { + -webkit-box-pack: center; + -ms-flex-pack: center; justify-content: center; text-align: center; } .end-xs { + -webkit-box-pack: end; + -ms-flex-pack: end; justify-content: flex-end; text-align: end; } .top-xs { + -webkit-box-align: start; + -ms-flex-align: start; align-items: flex-start; } .middle-xs { + -webkit-box-align: center; + -ms-flex-align: center; align-items: center; } .bottom-xs { + -webkit-box-align: end; + -ms-flex-align: end; align-items: flex-end; } .around-xs { + -ms-flex-pack: distribute; justify-content: space-around; } .between-xs { + -webkit-box-pack: justify; + -ms-flex-pack: justify; justify-content: space-between; } .first-xs { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; order: -1; } .last-xs { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; order: 1; } .initial-order-xs { + -webkit-box-ordinal-group: NaN; + -ms-flex-order: initial; order: initial; } -@media (--sm-viewport) { +@media only screen and (min-width: 576px) { .col-sm { + -webkit-box-flex: 1; + -ms-flex-positive: 1; flex-grow: 1; + -ms-flex-preferred-size: 0; flex-basis: 0; max-width: 100%; } .col-sm-1 { + -ms-flex-preferred-size: 8.33333333%; flex-basis: 8.33333333%; max-width: 8.33333333%; } .col-sm-2 { + -ms-flex-preferred-size: 16.66666667%; flex-basis: 16.66666667%; max-width: 16.66666667%; } .col-sm-3 { + -ms-flex-preferred-size: 25%; flex-basis: 25%; max-width: 25%; } .col-sm-4 { + -ms-flex-preferred-size: 33.33333333%; flex-basis: 33.33333333%; max-width: 33.33333333%; } .col-sm-5 { + -ms-flex-preferred-size: 41.66666667%; flex-basis: 41.66666667%; max-width: 41.66666667%; } .col-sm-6 { + -ms-flex-preferred-size: 50%; flex-basis: 50%; max-width: 50%; } .col-sm-7 { + -ms-flex-preferred-size: 58.33333333%; flex-basis: 58.33333333%; max-width: 58.33333333%; } .col-sm-8 { + -ms-flex-preferred-size: 66.66666667%; flex-basis: 66.66666667%; max-width: 66.66666667%; } .col-sm-9 { + -ms-flex-preferred-size: 75%; flex-basis: 75%; max-width: 75%; } .col-sm-10 { + -ms-flex-preferred-size: 83.33333333%; flex-basis: 83.33333333%; max-width: 83.33333333%; } .col-sm-11 { + -ms-flex-preferred-size: 91.66666667%; flex-basis: 91.66666667%; max-width: 91.66666667%; } .col-sm-12 { + -ms-flex-preferred-size: 100%; flex-basis: 100%; max-width: 100%; } @@ -495,54 +540,75 @@ margin-left: 91.66666667%; } .start-sm { + -webkit-box-pack: start; + -ms-flex-pack: start; justify-content: flex-start; text-align: start; } .center-sm { + -webkit-box-pack: center; + -ms-flex-pack: center; justify-content: center; text-align: center; } .end-sm { + -webkit-box-pack: end; + -ms-flex-pack: end; justify-content: flex-end; text-align: end; } .top-sm { + -webkit-box-align: start; + -ms-flex-align: start; align-items: flex-start; } .middle-sm { + -webkit-box-align: center; + -ms-flex-align: center; align-items: center; } .bottom-sm { + -webkit-box-align: end; + -ms-flex-align: end; align-items: flex-end; } .around-sm { + -ms-flex-pack: distribute; justify-content: space-around; } .between-sm { + -webkit-box-pack: justify; + -ms-flex-pack: justify; justify-content: space-between; } .first-sm { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; order: -1; } .last-sm { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; order: 1; } .initial-order-sm { + -webkit-box-ordinal-group: NaN; + -ms-flex-order: initial; order: initial; } } -@media (--md-viewport) { +@media only screen and (min-width: 768px) { .col-md, .col-md-1, .col-md-2, @@ -570,73 +636,90 @@ .col-md-offset-10, .col-md-offset-11, .col-md-offset-12 { box-sizing: border-box; + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; flex: 0 0 auto; - padding-right: var(--half-gutter-width, 08px); - padding-left: var(--half-gutter-width, 08px); + padding-right: 8px; + padding-left: 8px; } .col-md { + -webkit-box-flex: 1; + -ms-flex-positive: 1; flex-grow: 1; + -ms-flex-preferred-size: 0; flex-basis: 0; max-width: 100%; } .col-md-1 { + -ms-flex-preferred-size: 8.33333333%; flex-basis: 8.33333333%; max-width: 8.33333333%; } .col-md-2 { + -ms-flex-preferred-size: 16.66666667%; flex-basis: 16.66666667%; max-width: 16.66666667%; } .col-md-3 { + -ms-flex-preferred-size: 25%; flex-basis: 25%; max-width: 25%; } .col-md-4 { + -ms-flex-preferred-size: 33.33333333%; flex-basis: 33.33333333%; max-width: 33.33333333%; } .col-md-5 { + -ms-flex-preferred-size: 41.66666667%; flex-basis: 41.66666667%; max-width: 41.66666667%; } .col-md-6 { + -ms-flex-preferred-size: 50%; flex-basis: 50%; max-width: 50%; } .col-md-7 { + -ms-flex-preferred-size: 58.33333333%; flex-basis: 58.33333333%; max-width: 58.33333333%; } .col-md-8 { + -ms-flex-preferred-size: 66.66666667%; flex-basis: 66.66666667%; max-width: 66.66666667%; } .col-md-9 { + -ms-flex-preferred-size: 75%; flex-basis: 75%; max-width: 75%; } .col-md-10 { + -ms-flex-preferred-size: 83.33333333%; flex-basis: 83.33333333%; max-width: 83.33333333%; } .col-md-11 { + -ms-flex-preferred-size: 91.66666667%; flex-basis: 91.66666667%; max-width: 91.66666667%; } .col-md-12 { + -ms-flex-preferred-size: 100%; flex-basis: 100%; max-width: 100%; } @@ -690,54 +773,75 @@ margin-left: 91.66666667%; } .start-md { + -webkit-box-pack: start; + -ms-flex-pack: start; justify-content: flex-start; text-align: start; } .center-md { + -webkit-box-pack: center; + -ms-flex-pack: center; justify-content: center; text-align: center; } .end-md { + -webkit-box-pack: end; + -ms-flex-pack: end; justify-content: flex-end; text-align: end; } .top-md { + -webkit-box-align: start; + -ms-flex-align: start; align-items: flex-start; } .middle-md { + -webkit-box-align: center; + -ms-flex-align: center; align-items: center; } .bottom-md { + -webkit-box-align: end; + -ms-flex-align: end; align-items: flex-end; } .around-md { + -ms-flex-pack: distribute; justify-content: space-around; } .between-md { + -webkit-box-pack: justify; + -ms-flex-pack: justify; justify-content: space-between; } .first-md { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; order: -1; } .last-md { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; order: 1; } .initial-order-md { + -webkit-box-ordinal-group: NaN; + -ms-flex-order: initial; order: initial; } } -@media (--lg-viewport) { +@media only screen and (min-width: 992px) { .col-lg, .col-lg-1, .col-lg-2, @@ -765,73 +869,90 @@ .col-lg-offset-10, .col-lg-offset-11, .col-lg-offset-12 { box-sizing: border-box; + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; flex: 0 0 auto; - padding-right: var(--half-gutter-width, 08px); - padding-left: var(--half-gutter-width, 08px); + padding-right: 8px; + padding-left: 8px; } .col-lg { + -webkit-box-flex: 1; + -ms-flex-positive: 1; flex-grow: 1; + -ms-flex-preferred-size: 0; flex-basis: 0; max-width: 100%; } .col-lg-1 { + -ms-flex-preferred-size: 8.33333333%; flex-basis: 8.33333333%; max-width: 8.33333333%; } .col-lg-2 { + -ms-flex-preferred-size: 16.66666667%; flex-basis: 16.66666667%; max-width: 16.66666667%; } .col-lg-3 { + -ms-flex-preferred-size: 25%; flex-basis: 25%; max-width: 25%; } .col-lg-4 { + -ms-flex-preferred-size: 33.33333333%; flex-basis: 33.33333333%; max-width: 33.33333333%; } .col-lg-5 { + -ms-flex-preferred-size: 41.66666667%; flex-basis: 41.66666667%; max-width: 41.66666667%; } .col-lg-6 { + -ms-flex-preferred-size: 50%; flex-basis: 50%; max-width: 50%; } .col-lg-7 { + -ms-flex-preferred-size: 58.33333333%; flex-basis: 58.33333333%; max-width: 58.33333333%; } .col-lg-8 { + -ms-flex-preferred-size: 66.66666667%; flex-basis: 66.66666667%; max-width: 66.66666667%; } .col-lg-9 { + -ms-flex-preferred-size: 75%; flex-basis: 75%; max-width: 75%; } .col-lg-10 { + -ms-flex-preferred-size: 83.33333333%; flex-basis: 83.33333333%; max-width: 83.33333333%; } .col-lg-11 { + -ms-flex-preferred-size: 91.66666667%; flex-basis: 91.66666667%; max-width: 91.66666667%; } .col-lg-12 { + -ms-flex-preferred-size: 100%; flex-basis: 100%; max-width: 100%; } @@ -885,54 +1006,75 @@ margin-left: 91.66666667%; } .start-lg { + -webkit-box-pack: start; + -ms-flex-pack: start; justify-content: flex-start; text-align: start; } .center-lg { + -webkit-box-pack: center; + -ms-flex-pack: center; justify-content: center; text-align: center; } .end-lg { + -webkit-box-pack: end; + -ms-flex-pack: end; justify-content: flex-end; text-align: end; } .top-lg { + -webkit-box-align: start; + -ms-flex-align: start; align-items: flex-start; } .middle-lg { + -webkit-box-align: center; + -ms-flex-align: center; align-items: center; } .bottom-lg { + -webkit-box-align: end; + -ms-flex-align: end; align-items: flex-end; } .around-lg { + -ms-flex-pack: distribute; justify-content: space-around; } .between-lg { + -webkit-box-pack: justify; + -ms-flex-pack: justify; justify-content: space-between; } .first-lg { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; order: -1; } .last-lg { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; order: 1; } .initial-order-lg { + -webkit-box-ordinal-group: NaN; + -ms-flex-order: initial; order: initial; } } -@media (--xl-viewport) { +@media only screen and (min-width: 1200px) { .col-xl, .col-xl-1, .col-xl-2, @@ -960,73 +1102,90 @@ .col-xl-offset-10, .col-xl-offset-11, .col-xl-offset-12 { box-sizing: border-box; + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; flex: 0 0 auto; - padding-right: var(--half-gutter-width, 08px); - padding-left: var(--half-gutter-width, 08px); + padding-right: 8px; + padding-left: 8px; } .col-xl { + -webkit-box-flex: 1; + -ms-flex-positive: 1; flex-grow: 1; + -ms-flex-preferred-size: 0; flex-basis: 0; max-width: 100%; } .col-xl-1 { + -ms-flex-preferred-size: 8.33333333%; flex-basis: 8.33333333%; max-width: 8.33333333%; } .col-xl-2 { + -ms-flex-preferred-size: 16.66666667%; flex-basis: 16.66666667%; max-width: 16.66666667%; } .col-xl-3 { + -ms-flex-preferred-size: 25%; flex-basis: 25%; max-width: 25%; } .col-xl-4 { + -ms-flex-preferred-size: 33.33333333%; flex-basis: 33.33333333%; max-width: 33.33333333%; } .col-xl-5 { + -ms-flex-preferred-size: 41.66666667%; flex-basis: 41.66666667%; max-width: 41.66666667%; } .col-xl-6 { + -ms-flex-preferred-size: 50%; flex-basis: 50%; max-width: 50%; } .col-xl-7 { + -ms-flex-preferred-size: 58.33333333%; flex-basis: 58.33333333%; max-width: 58.33333333%; } .col-xl-8 { + -ms-flex-preferred-size: 66.66666667%; flex-basis: 66.66666667%; max-width: 66.66666667%; } .col-xl-9 { + -ms-flex-preferred-size: 75%; flex-basis: 75%; max-width: 75%; } .col-xl-10 { + -ms-flex-preferred-size: 83.33333333%; flex-basis: 83.33333333%; max-width: 83.33333333%; } .col-xl-11 { + -ms-flex-preferred-size: 91.66666667%; flex-basis: 91.66666667%; max-width: 91.66666667%; } .col-xl-12 { + -ms-flex-preferred-size: 100%; flex-basis: 100%; max-width: 100%; } @@ -1080,78 +1239,99 @@ margin-left: 91.66666667%; } .start-xl { + -webkit-box-pack: start; + -ms-flex-pack: start; justify-content: flex-start; text-align: start; } .center-xl { + -webkit-box-pack: center; + -ms-flex-pack: center; justify-content: center; text-align: center; } .end-xl { + -webkit-box-pack: end; + -ms-flex-pack: end; justify-content: flex-end; text-align: end; } .top-xl { + -webkit-box-align: start; + -ms-flex-align: start; align-items: flex-start; } .middle-xl { + -webkit-box-align: center; + -ms-flex-align: center; align-items: center; } .bottom-xl { + -webkit-box-align: end; + -ms-flex-align: end; align-items: flex-end; } .around-xl { + -ms-flex-pack: distribute; justify-content: space-around; } .between-xl { + -webkit-box-pack: justify; + -ms-flex-pack: justify; justify-content: space-between; } .first-xl { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; order: -1; } .last-xl { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; order: 1; } .initial-order-xl { + -webkit-box-ordinal-group: NaN; + -ms-flex-order: initial; order: initial; } } -@media (--xs-only) { +@media only screen and (max-width: 575px) { .hidden-xs { display: none; } } -@media (--sm-only) { +@media only screen and (min-width: 576px) and (max-width: 767px) { .hidden-sm { display: none; } } -@media (--md-only) { +@media only screen and (min-width: 768px) and (max-width: 991px) { .hidden-md { display: none; } } -@media (--lg-only) { +@media only screen and (min-width: 992px) and (max-width: 1199px) { .hidden-lg { display: none; } } -@media (--xl-only) { +@media only screen and (min-width: 1200px) { .hidden-xl { display: none; }