Skip to content

Commit ae1a440

Browse files
committed
make center round crop on team images
1 parent 01de802 commit ae1a440

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

assets/css/style.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,23 @@ table {
6666
[data-bs-theme="dark"] .logo-dark {
6767
display: inline-block;
6868
}
69+
70+
/* Make sure the wrapper constrains the image */
71+
.avatar{
72+
width: min(384px, 95%);
73+
height: auto;
74+
aspect-ratio: 1/1;
75+
border-radius: 50%;
76+
overflow: hidden;
77+
margin: 0 auto 0.75rem;
78+
}
79+
80+
/* Force the image to fill the wrapper and crop */
81+
.avatar > img{
82+
width: 100% !important;
83+
height: 100% !important;
84+
max-width: none !important; /* prevents unexpected max-width constraints */
85+
display: block;
86+
object-fit: cover;
87+
object-position: 50% 20%; /* crop upwards */
88+
}

templates/team.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ <h3>{{ title }}</h3>
1414
<div class="card text-center col-sm-6 col-md-3 mb-3">
1515
<div class="card-body">
1616
<h5 class="card-title">{{ member.name }}</h5>
17-
<img
18-
class="card-img-top"
19-
tabindex="0"
17+
<div class="avatar">
18+
<img
2019
src="{{ member.photo }}"
2120
alt="{{ member.photo_alt }}"
22-
style="width: 90%">
21+
tabindex="0"
22+
loading="lazy"
23+
decoding="async">
24+
</div>
2325
<!-- <img src="{{ member.photo }}" alt="{{ member.name }}" > -->
2426
<p class="card-text">{{ member.role }}
2527
<br>

0 commit comments

Comments
 (0)