Skip to content

Commit 7e511e3

Browse files
authored
Cleanup css & fix styling for the blog index page (#12)
1 parent e97e57a commit 7e511e3

File tree

2 files changed

+32
-61
lines changed

2 files changed

+32
-61
lines changed
Lines changed: 24 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,22 @@
1-
body * {
2-
font-weight: 400;
3-
line-height: 1.5;
4-
}
5-
61
.post {
7-
display: flex;
8-
flex-direction: column;
9-
align-items: center;
10-
justify-content: center;
11-
margin: 0.2rem auto;
2+
padding: 1rem;
123
}
134

14-
.post .img-link {
15-
margin: 0.4rem;
16-
width: 80%;
5+
.img-link {
176
display: flex;
187
align-items: center;
8+
justify-content: center;
9+
margin-bottom: 1.5rem;
1910
}
2011

21-
.post img {
22-
object-fit: cover;
23-
border-radius: 3%;
24-
}
25-
26-
.post-info-container {
27-
display: flex;
28-
flex-direction: column;
29-
justify-content: space-around;
30-
margin-left: 1rem;
31-
}
32-
33-
.post-info-container h2 {
34-
margin-bottom: 0;
35-
margin-top: 0.5rem;
36-
}
37-
38-
.author-name {
39-
font-weight: bold;
12+
img {
13+
width: 100%;
4014
}
4115

4216
.date {
4317
color: #6C757D;
4418
}
4519

46-
4720
.post * {
4821
font-family: "Merriweather", serif;
4922
}
@@ -53,45 +26,47 @@ body * {
5326
}
5427

5528
.post-intro {
56-
margin: 0.5rem;
57-
}
58-
59-
.post-info {
60-
display: flex;
61-
flex-direction: column;
62-
justify-content: space-around;
29+
margin-top: 0.5rem;
6330
}
6431

65-
.post-info span {
66-
margin: 0 0.5rem;
32+
.author-name, .date {
33+
margin-bottom: 0;
6734
}
6835

69-
.post a {
36+
a {
7037
color: black;
7138
text-decoration: none;
7239
}
7340

74-
.post a:hover {
75-
text-decoration: none;
41+
a:hover {
42+
color: #484848;
7643
}
7744

7845
hr {
7946
background-color: #989898;
8047
height: 1px;
8148
border: none;
82-
margin-top: 0;
49+
margin-top: 1rem;
50+
margin-bottom: 1rem;
8351
}
8452

8553
/* Large devices (desktops, 992px and up) */
8654
@media (min-width: 992px) {
8755

8856
.post {
57+
display: flex;
58+
align-items: center;
8959
flex-direction: row;
9060
justify-content: stretch;
9161
}
9262

93-
.post .img-link {
94-
width: 15rem;
95-
height: 10rem;
63+
.img-link {
64+
margin-bottom: 0rem;
65+
margin-right: 1.5rem;
66+
width: 240px;
67+
}
68+
69+
img {
70+
width: 240px;
9671
}
9772
}

wagtail_code_blog/templates/wagtail_code_blog/blog_index_page_body.html

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@
44
<div class="post">
55
{% if post.image_url %}
66
<a class="img-link" href="{% pageurl post %}">
7-
<img src="{{ post.image_url }}" class="img-fluid" alt="Responsive image">
7+
<img src="{{ post.image_url }}" alt="{{ post.title }}">
88
</a>
99
{% endif %}
1010
<a href="{% pageurl post %}">
11-
<div class="post-info-container">
12-
<h2 class="post-title">{{ post.title }}</h2>
13-
{% if post.intro %}
14-
<p class="post-intro">{{ post.intro }}</p>
15-
{% endif %}
16-
<div class="post-info">
17-
<span class="author-name">{{ post.author_name }}</span>
18-
<span class="date">{{ post.date }}</span>
19-
</div>
20-
</div>
11+
<h2 class="post-title">{{ post.title }}</h2>
12+
{% if post.intro %}
13+
<p class="post-intro">{{ post.intro }}</p>
14+
{% endif %}
15+
<p class="author-name"><b>{{ post.author_name }}</b></p>
16+
<p class="date">{{ post.date }}</p>
2117
</a>
2218
</div>
23-
<hr>
19+
<hr />
2420
{% endfor %}

0 commit comments

Comments
 (0)