Use the image component to present a full-width image banner on a page. The banner is a simple image shown in the aspect ratio of the image itself (so not 8:5 by default) with a max-width of the maximum grid container size, set in the $bp-container
variable, or the viewport width (for smaller screens).
For images, the following requirements should be followed:
The image components also adds the benefit of providing an optional caption tag.
<div class="banner-image-container full-width">
<div class="banner-image">
{% include '@image' with {
src: 'https://via.placeholder.com/1800x500&text=18:5+(1800x500)',
alt_text: image|first.alt,
caption: image|first.caption
} %}
</div>
</div>
<div class="banner-image-container full-width">
<div class="banner-image">
<figure><img src="https://via.placeholder.com/1800x500&text=18:5+(1800x500)" alt="placeholder image alternative text" />
<figcaption>image caption</figcaption>
</figure>
</div>
</div>
{
"image": [
{
"src": "https://via.placeholder.com/800x500&text=8:5+(800x500)",
"alt": "placeholder image alternative text",
"caption": "image caption"
}
]
}
.banner-image {
position: relative;
max-width: calc($bp-container + $container-padding*2);
margin: 0 auto;
padding: 0 $container-padding;
text-align: center;
figure {
display: inline-block;
position: relative;
max-width: 100%;
img {
width: auto;
margin: 0 auto;
}
}
figcaption {
display: none;
max-width: $bp-container;
@include tablet {
display: block;
}
}
}