<div class="card">
<div class="card__object">
<div class="card__avatar">
<img src="https://media-exp1.licdn.com/dms/image/C5603AQG9JCcSU89gTg/profile-displayphoto-shrink_200_200/0?e=1592438400&v=beta&t=HIWU0K4mFvIm5eAXPvb7wps7qKDY4MoUV1S6wPeZl30" />
</div>
</div>
<div class="card__body">
<h3>Alan Dong</h3>
<h4>Digital Product Designer</h4>
<p>Build it in a scalable way, we moved slow to move fast.</p>
<div><a href="#" class="btn">View Profile</a></div>
</div>
</div>
body {
margin: 0px;
padding: 0px;
width: 100vw;
min-height: 100vh;
font-family: helvetica;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
}
.card {
width: 30vw;
min-height: 60vh;
border-radius: 8px;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
}
.card__object {
height: 15vh;
width: 100%;
border-radius: 8px 8px 0 0;
display: flex;
justify-content: center;
}
.card__avatar {
width: 80px;
height: 80px;
border-radius: 50%;
padding: 5px;
transform: translateY(calc(15vh - 40px));
}
.card__avatar img {
width: 80px;
height: 80px;
border-radius: 50%;
}
.card__body {
min-height: 28vh;
padding: 50px 20px 40px;
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
border-radius: 0 0 8px 8px;
}
.card__body h3,
.card__body h4 {
box-sizing: border-box;
line-height: 1.6;
font-weight: bold;
}
.card__body h4 {
opacity: 0.4;
}
.card__body p {
font-size: 16px;
margin-bottom: 30px;
}
.card__body .btn {
padding: 12px 20px;
border: none;
border-radius: 32px;
font-size: 12px;
text-decoration: none;
font-weight: bold;
transition: all 0.1s ease-in;
}
.card__body .btn:hover {
background: transparent;
border: 1px solid currentColor;
}
:root {
--color: #333;
--primary-color: #ffffff; /* 主色 */
--body-bg-color: #f1f1f1; /* body背景颜色 */
--card-box-shadow-color: #405070; /* card盒子阴影颜色 */
--btn-bg-color: #28c3f5; /* button背景颜色 */
--paragraph-color: gray; /* 段落文本颜色 */
--card-object-bg-color: #eaeff8; /* card顶部背景颜色 */
--title-color: #101c34; /* 标题2文本颜色 */
--avatar-bg-color: #fff;
}
@media (prefers-color-scheme: dark) {
:root {
--color: #fff;
--primary-color: #1a1515; /* 主色 */
--body-bg-color: #1a1818; /* body背景颜色 */
--card-box-shadow-color: #6a716e; /* card盒子阴影颜色 */
--btn-bg-color: #ff5722; /* button背景颜色 */
--paragraph-color: #c7c1c1; /* 段落文本颜色 */
--card-object-bg-color: #282035; /* card顶部背景颜色 */
--title-color: #ffffff; /* 标题2文本颜色 */
--avatar-bg-color: #673ab7;
}
}
body {
background-color: var(--body-bg-color);
color: var(--color);
}
.card {
background: var(--primary-color);
box-shadow: 0px 1px 10px 1px var(--card-box-shadow-color);
}
.card__object {
background-color: var(--card-object-bg-color);
}
.card__avatar {
background-color: var(--avatar-bg-color);
}
.card__body h4 {
color: var(--title-color);
}
.card__body p {
color: var(--paragraph-color);
}
.card__body .btn {
background: var(--btn-bg-color);
color: var(--primary-color);
}
.card__body .btn:hover {
color: var(--btn-bg-color);
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.