787bd61ce6
Added modernizr script to image Cover example Added Aspect Ratio variables Fixed image->fit aspect ratio to w/h instead of h/w Added impotrant to width/height in image ->cover TODO vertical center mixin
38 lines
591 B
SCSS
38 lines
591 B
SCSS
@mixin image-fit($heightaspect) {
|
|
/* image fit */
|
|
position: relative;
|
|
display: inline-block;
|
|
overflow: hidden;
|
|
text-align: center;
|
|
|
|
img {
|
|
position: absolute;
|
|
object-fit: fill !important;
|
|
|
|
width: auto;
|
|
height: auto;
|
|
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
|
|
&.landscape {
|
|
min-width: 100%;
|
|
height: auto;
|
|
}
|
|
|
|
&.portrait {
|
|
min-height: 100%;
|
|
width: auto;
|
|
}
|
|
}
|
|
|
|
&:after {
|
|
content: "";
|
|
display: block;
|
|
padding-bottom: 100% / $heightaspect;
|
|
}
|
|
} |