@superflycss/utilities-layout
Version:
332 lines (278 loc) • 6.51 kB
CSS
/** @define utilities */
@import "@superflycss/variables-dimension";
@media (--md-viewport) {
/**
* Specify the proportional width of an object.
* Intentional redundancy build into each set of unit classes.
* Supports: 2, 3, 4, 5, 6, 8, 10, 12 part
*
* 1. Use `flex-basis: auto` with a width to avoid box-sizing bug in IE10/11
* http://git.io/vllMD
*/
.u-md-size1of12 {
flex-basis: auto ;
width: calc(100% * 1 / 12) ;
}
.u-md-size1of10 {
flex-basis: auto ;
width: 10% ;
}
.u-md-size1of8 {
flex-basis: auto ;
width: 12.5% ;
}
.u-md-size1of6,
.u-md-size2of12 {
flex-basis: auto ;
width: calc(100% * 1 / 6) ;
}
.u-md-size1of5,
.u-md-size2of10 {
flex-basis: auto ;
width: 20% ;
}
.u-md-size1of4,
.u-md-size2of8,
.u-md-size3of12 {
flex-basis: auto ;
width: 25% ;
}
.u-md-size3of10 {
flex-basis: auto ;
width: 30% ;
}
.u-md-size1of3,
.u-md-size2of6,
.u-md-size4of12 {
flex-basis: auto ;
width: calc(100% * 1 / 3) ;
}
.u-md-size3of8 {
flex-basis: auto ;
width: 37.5% ;
}
.u-md-size2of5,
.u-md-size4of10 {
flex-basis: auto ;
width: 40% ;
}
.u-md-size5of12 {
flex-basis: auto ;
width: calc(100% * 5 / 12) ;
}
.u-md-size1of2,
.u-md-size2of4,
.u-md-size3of6,
.u-md-size4of8,
.u-md-size5of10,
.u-md-size6of12 {
flex-basis: auto ;
width: 50% ;
}
.u-md-size7of12 {
flex-basis: auto ;
width: calc(100% * 7 / 12) ;
}
.u-md-size3of5,
.u-md-size6of10 {
flex-basis: auto ;
width: 60% ;
}
.u-md-size5of8 {
flex-basis: auto ;
width: 62.5% ;
}
.u-md-size2of3,
.u-md-size4of6,
.u-md-size8of12 {
flex-basis: auto ;
width: calc(100% * 2 / 3) ;
}
.u-md-size7of10 {
flex-basis: auto ;
width: 70% ;
}
.u-md-size3of4,
.u-md-size6of8,
.u-md-size9of12 {
flex-basis: auto ;
width: 75% ;
}
.u-md-size4of5,
.u-md-size8of10 {
flex-basis: auto ;
width: 80% ;
}
.u-md-size5of6,
.u-md-size10of12 {
flex-basis: auto ;
width: calc(100% * 5 / 6) ;
}
.u-md-size7of8 {
flex-basis: auto ;
width: 87.5% ;
}
.u-md-size9of10 {
flex-basis: auto ;
width: 90% ;
}
.u-md-size11of12 {
flex-basis: auto ;
width: calc(100% * 11 / 12) ;
}
/* Intrinsic widths
========================================================================== */
/**
* Make an element shrink wrap its content.
*/
.u-md-sizeFit {
flex-basis: auto ;
width: auto ;
}
/**
* Make an element fill the remaining space.
*
* 1. Be explicit to work around IE10 bug with shorthand flex
* http://git.io/vllC7
* 2. IE10 ignores previous `flex-basis` value. Setting again here fixes
* http://git.io/vllMt
*/
.u-md-sizeFill {
flex: 1 1 0% ; /* 1 */
flex-basis: 0% ; /* 2 */
}
/**
* An alternative method to make an element fill the remaining space.
* Distributes space based on the initial width and height of the element
*
* http://www.w3.org/TR/css-flexbox/images/rel-vs-abs-flex.svg
*/
.u-md-sizeFillAlt {
flex: 1 1 auto ;
flex-basis: auto ;
}
/**
* Make an element the width of its parent.
*/
.u-md-sizeFull {
width: 100% ;
}
.u-md-height-halfrem {
height: 0.5rem ;
}
.u-md-h-halfrem {
height: 0.5rem ;
}
.u-md-min-height-halfrem {
min-height: 0.5rem ;
}
.u-md-mh-halfrem {
min-height: 0.5rem ;
}
.u-md-max-height-halfrem {
max-height: 0.5rem ;
}
.u-md-mxh-halfrem {
max-height: 0.5rem ;
}
.u-md-height-100 {
height: 100% ;
}
.u-md-h100 {
height: 100% ;
}
.u-md-min-width-halfrem {
min-width: 0.5rem ;
}
.u-md-mw-halfrem {
min-width: 0.5rem ;
}
.u-md-max-width-halfrem {
max-width: 0.5rem ;
}
.u-md-mxw-halfrem {
max-width: 0.5rem ;
}
.u-md-width-halfrem {
width: 0.5rem ;
}
.u-md-w-halfrem {
width: 0.5rem ;
}
.u-md-width-100 {
width: 100% ;
}
.u-md-w100 {
width: 100% ;
}
@for $factor from 0 to 100 {
.u-md-height$(factor)px {
height: $(factor)px ;
}
.u-md-h$(factor)px {
height: $(factor)px ;
}
.u-md-min-height$(factor)px {
min-height: $(factor)px ;
}
.u-md-mh$(factor)px {
min-height: $(factor)px ;
}
.u-md-max-height$(factor)px {
max-height: $(factor)px ;
}
.u-md-mxh$(factor)px {
max-height: $(factor)px ;
}
.u-md-min-width$(factor)px {
min-width: $(factor)px ;
}
.u-md-mw$(factor)px {
min-width: $(factor)px ;
}
.u-md-max-width$(factor)px {
max-width: $(factor)px ;
}
.u-md-width$(factor)px {
width: $(factor)px ;
}
.u-md-w$(factor)px {
width: $(factor)px ;
}
}
@for $factor from 0 to 100 {
.u-md-height-$(factor)rem {
height: $(factor) rem ;
}
.u-md-h$(factor)rem {
height: $(factor) rem ;
}
.u-md-min-height-$(factor)rem {
min-height: $(factor) rem ;
}
.u-md-mh$(factor)rem {
min-height: $(factor) rem ;
}
.u-md-max-height-$(factor)rem {
max-height: $(factor) rem ;
}
.u-md-mxh$(factor)rem {
max-height: $(factor) rem ;
}
.u-md-min-width-$(factor)rem {
min-width: $(factor) rem ;
}
.u-md-mw$(factor)rem {
min-width: $(factor) rem ;
}
.u-md-max-width-$(factor)rem {
max-width: $(factor) rem ;
}
.u-md-width-$(factor)rem {
width: $(factor) rem ;
}
.u-md-w$(factor)rem {
width: $(factor) rem ;
}
}
}