效果展示
参考代码
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="/css/main.css">
</head>
<body>
<div class="user-card">
<div class="user-card-header"></div>
<div class="user-card-body">
<div class="user-card-body-left">
<a href="#">
<img src="/images/maliao.jpg" alt="">
</a>
</div>
<div class="user-card-body-right">
<div class="user-card-body-right-text">
<div class="user-card-body-right-text-username">
<a href="#">清水崆峒派</a>
<span>LV3</span>
</div>
<div class="user-card-body-right-text-reputation">
<span class="user-card-body-right-text-reputation-item">
<span>
<a class="item-index" href="#">255</a>
</span>
<span>
<a class="item-index" href="#">关注</a>
</span>
</span>
<span class="user-card-body-right-text-reputation-item">
<span>
<a class="item-index" href="#">4</a>
</span>
<span>
<a class="item-index" href="#">粉丝</a>
</span>
</span>
<span class="user-card-body-right-text-reputation-item">
<span>0</span>
<span>获赞</span>
</span>
</div>
</div>
<div class="user-card-body-right-botton">
<button>+关注</button>
<button>发消息</button>
</div>
</div>
</div>
</div>
</body>
</html>
CSS
.user-card {
width: 366px;
height: 222.4px;
box-shadow: 2px 2px 5px lightgrey;
border-radius: 3px;
display: inline-block;
}
.user-card-header {
background-image: url(/images/mountain.jpg);
background-size: cover;
width: 100%;
height: 85px;
}
.user-card-body {
width: 100%;
height: calc(100% - 85px);
box-sizing: border-box;
padding-top: 12px;
}
.user-card-body-left {
width: 70px;
height: 100%;
float: left;
text-align: center;
}
.user-card-body-right {
width: calc(100% - 70px);
height: 100%;
float: left;
}
.user-card-body-left > a > img {
width: 48px;
height: 48px;
border-radius: 50%;
}
.user-card-body-right-text {
width: 100%;
height: 70%;
}
.user-card-body-right-text-username > a {
padding-left: 10px;
font-size: 15px;
color: #222222;
font-weight: bold;
text-decoration: none;
}
.user-card-body-right-text-username > a:hover {
color: #00A1D9;
transition: 200ms;
}
.user-card-body-right-text-username > span {
font-size: 12px;
color: #7BCDEF;
font-style: italic;
}
.user-card-body-right-text-reputation {
padding-left: 10px;
padding-top: 12px;
box-sizing: border-box;
}
.user-card-body-right-text-reputation-item {
margin-right: 18px;
}
.user-card-body-right-text-reputation-item > span:nth-child(1) .item-index {
font-size: 12px;
color: #18191C;
font-weight: 500px;
text-decoration: none;
}
.user-card-body-right-text-reputation-item > span:nth-child(2) .item-index {
font-size: 12px;
color: #9499A0;
text-decoration: none;
}
.user-card-body-right-text-reputation-item > span:nth-child(2) .item-index:hover {
color: #00A1D6;
transition: 400ms;
}
.user-card-body-right-text-reputation-item > span:nth-child(1) {
font-size: 12px;
color: #18191C;
font-weight: 500px;
}
.user-card-body-right-text-reputation-item > span:nth-child(2) {
font-size: 12px;
color: #9499A0;
}
.user-card-body-right-botton {
padding-left: 10px;
}
.user-card-body-right-botton > button {
width: 102px;
height: 32px;
border-radius: 3px;
margin-right: 5px;
}
.user-card-body-right-botton > button:nth-child(1) {
background-color: #00a1d6;
color: #FFFFFF;
border: none;
border-radius: 3px;
}
.user-card-body-right-botton > button:nth-child(1):hover {
background-color: #33B4DE;
transition: 600ms;
}
.user-card-body-right-botton > button:nth-child(2) {
background-color: #FFFFFF;
color: #6d757a;
border: #CCD0D7 solid 1px;
}
.user-card-body-right-botton > button:nth-child(2):hover {
border: #00B5E5 solid 1px;
transition: 700ms;
}