Skip to content

Commit fa4e416

Browse files
committed
fix: fixed ratio in post image
1 parent 0d2ae6f commit fa4e416

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/lib/component/Post.svelte

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<div class="card mb-3">
22
{#if post.thumbnailUrl}
33
<a href="/post/{post.url}">
4-
<img
5-
src={post.thumbnailUrl}
6-
class="card-img-top rounded-top"
7-
alt={post.title}
8-
title={post.title} />
4+
<div
5+
style="
6+
aspect-ratio: 16 / 9;
7+
width: 100%;
8+
overflow: hidden;
9+
"
10+
>
11+
<img
12+
src={post.thumbnailUrl}
13+
class="card-img-top rounded-top h-100 w-100"
14+
style="object-fit: cover;"
15+
alt={post.title}
16+
title={post.title} />
17+
</div>
918
</a>
1019
{/if}
1120
<div class="card-body">

0 commit comments

Comments
 (0)