Skip to content

Commit

Permalink
Set width and height for responsive image.
Browse files Browse the repository at this point in the history
  • Loading branch information
luukbrauckmann committed Oct 18, 2024
1 parent b8fadd3 commit be8c674
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/blocks/ImageBlock/Image.astro
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ const imageUnavailableMessage = t('image_unavailable');
loading={ loading }
srcset={ getImageSrcSet(image.url) }
src={ getImageSrc(image.url) }
height={image.height}
width={image.width}
style={{
aspectRatio: image.responsiveImage.aspectRatio,
backgroundImage: `url(${image.responsiveImage.base64})`
Expand All @@ -50,10 +48,8 @@ const imageUnavailableMessage = t('image_unavailable');
alt={ altText }
loading={ loading }
src={ image.url }
height={image.height}
width={image.width}
style={{
aspectRatio: `${image.width}/${image.height}`,
aspectRatio: `${image.width} / ${image.height}`,
}}
data-unavailable={ imageUnavailableMessage }
/>
Expand All @@ -68,9 +64,14 @@ const imageUnavailableMessage = t('image_unavailable');

<style>
/* functional styling */
figure {
max-width: 100%;
height: auto;
}

img {
display: block;
max-width: 100%;
width: 100%;
height: auto;
background-size: cover;
}
Expand Down

0 comments on commit be8c674

Please sign in to comment.