Files
SCSS-Framework/mixins/layout/image/_fit.scss
T
simongehrig 426dde5b61 Added
image fit

Enhanced
image cover
added aspect control
2017-04-05 09:24:14 +02:00

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;
}
}