在微博个人主页左侧有关注,粉丝和微博数量这几个数据,当然改版之后有所变化,需要实现的效果图大概就是下图这样的: HTML部分:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="./index.css" />
<title>Flex 布局</title>
</head>
<body>
<ul>
<li class="focus">
<div>
<div class="number">524</div>
<div class="text">关注</div>
</div>
</li>
<li class="fan">
<div>
<div class="number">18705761</div>
<div class="text">粉丝</div>
</div>
</li>
<li class="weibo">
<div>
<div class="number">1650</div>
<div class="text">微博</div>
</div>
</li>
</ul>
</body>
</html>
CSS部分:
html,
body {
height: 100%;
margin: 0;
}
ul,
li {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
h1,
h2 {
margin: 0;
}
p {
margin: 0;
padding: 0;
}
ul {
display: flex;
width: 300px;
height: 60px;
align-items: center;
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.2);
border-radius: 2px;
}
li {
flex: 1;
border-left: 1px solid #d9d9d9;
height: 36px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
li:first-child {
border: none;
}
li .number {
font-size: 12px;
color: #333333;
line-height: 14px;
margin-bottom: 6px;
}
li .text {
font-size: 12px;
color: #868686;
line-height: 14px;
}
|