Skip to content

Commit 0407783

Browse files
committed
Use picture element
1 parent cbc3de5 commit 0407783

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
img {
2+
position: absolute;
3+
top: 0;
4+
left: 0;
5+
object-fit: cover;
6+
height: 100%;
7+
width: 100%;
8+
}

src/LinkDotNet.Blog.Web/Features/Components/ShortBlogPost.razor

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
<article>
66
<div class="blog-card @AltCssClass">
77
<div class="meta">
8-
<div>
8+
<div class="photo">
99
<PreviewImage PreviewImageUrl="@BlogPost.PreviewImageUrl"
1010
PreviewImageUrlFallback="@BlogPost.PreviewImageUrlFallback"
1111
LazyLoadImage="@LazyLoadPreviewImage"></PreviewImage>
1212
</div>
13-
@* <div class="photo" style="background-image: url(@BlogPost.PreviewImageUrl)"></div> *@
1413
<ul class="details">
1514
<li class="date">@BlogPost.UpdatedDate.ToString("dd/MM/yyyy")</li>
1615
@if (BlogPost.Tags != null)

src/LinkDotNet.Blog.Web/Features/Components/ShortBlogPost.razor.css

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,11 @@
2323
.blog-card a:hover {
2424
color: #5ad67d;
2525
}
26-
.blog-card:hover .photo {
27-
transform: scale(1.3) rotate(3deg);
28-
}
2926
.blog-card .meta {
3027
position: relative;
3128
z-index: 0;
3229
height: 200px;
3330
}
34-
.blog-card .photo {
35-
position: absolute;
36-
top: 0;
37-
right: 0;
38-
bottom: 0;
39-
left: 0;
40-
background-size: cover;
41-
background-position: center;
42-
transition: transform 0.5s;
43-
}
4431
.blog-card .details,
4532
.blog-card .details ul {
4633
margin: auto;

0 commit comments

Comments
 (0)