90978: Responsive banner background image

This commit is contained in:
Yura Bondarenko
2022-04-27 18:13:44 +02:00
parent 7e391f0411
commit 572a10db6b
7 changed files with 19 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
<div class="background-image">
<div class="background-image-container">
<div class="container">
<div class="jumbotron jumbotron-fluid">
<div class="d-flex flex-wrap">
@@ -30,5 +30,10 @@
</ul>
</div>
</div>
<picture class="background-image">
<source type="image/webp" srcset="assets/dspace/images/banner.webp 2000w, assets/dspace/images/banner-half.webp 1200w, assets/dspace/images/banner-tall.webp 768w">
<source type="image/jpg" srcset="assets/dspace/images/banner.jpg 2000w, assets/dspace/images/banner-half.jpg 1200w, assets/dspace/images/banner-tall.jpg 768w">
<img alt="" [src]="'assets/dspace/images/banner.jpg'"/><!-- without the []="''" Firefox downloads both the fallback and the resolved image -->
</picture>
<small class="credits">Photo by <a href="https://www.pexels.com/@inspiredimages">@inspiredimages</a></small>
</div>

View File

@@ -2,12 +2,21 @@
display: block;
margin-top: calc(var(--ds-content-spacing) * -1);
div.background-image {
div.background-image-container {
color: white;
background-color: var(--bs-info);
position: relative;
background-image: url('/assets/dspace/images/banner.jpg');
background-size: cover;
.background-image > img {
background-color: var(--bs-info);
position: absolute;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
object-position: top;
}
.container {
position: relative;

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB