bulma/sass/elements/image.scss

65 lines
1.2 KiB
SCSS
Raw Normal View History

2024-11-11 10:22:12 +00:00
@use "sass:list";
2024-03-21 16:11:54 +00:00
@use "../utilities/initial-variables" as iv;
@use "../utilities/css-variables" as cv;
@use "../utilities/mixins" as mx;
$dimensions: 16 24 32 48 64 96 128 !default;
.#{iv.$class-prefix}image {
display: block;
position: relative;
img {
display: block;
height: auto;
width: 100%;
&.#{iv.$class-prefix}is-rounded {
border-radius: cv.getVar("radius-rounded");
}
}
&.#{iv.$class-prefix}is-fullwidth {
width: 100%;
}
// Ratio
&.#{iv.$class-prefix}is-square {
img,
.#{iv.$class-prefix}has-ratio {
@include mx.overlay;
height: 100%;
width: 100%;
}
}
&.#{iv.$class-prefix}is-square {
aspect-ratio: 1;
}
@each $pair in iv.$aspect-ratios {
2024-11-11 10:22:12 +00:00
$w: list.nth($pair, 1);
$h: list.nth($pair, 2);
2024-03-21 16:11:54 +00:00
&.#{iv.$class-prefix}is-#{$w}by#{$h} {
aspect-ratio: #{$w} / #{$h};
img,
.#{iv.$class-prefix}has-ratio {
@include mx.overlay;
height: 100%;
width: 100%;
}
}
}
// Sizes
@each $dimension in $dimensions {
&.#{iv.$class-prefix}is-#{$dimension}x#{$dimension} {
height: $dimension * 1px;
width: $dimension * 1px;
}
}
}