运行结果
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/index.css">
<title>Document</title>
</head>
<body>
<div class="banner">
<div class="content">
<div class="info">
<div class="pic"></div>
<div class="detail">
<h6>寻常常常</h6>
<p>君子不争炎凉</p>
</div>
</div>
<div class="other">
<a href="#" class="letter">私信</a href="#">
<a href="#" class="focus">关注</a href="#">
</div>
</div>
</div>
<div class="hobby">
<div class="song">喜欢的歌</div>
<div class="food">喜欢的食物</div>
<div class="novel">喜欢的小说</div>
</div>
<div class="ins">
<div class="one">写代码是一件让人快乐的事情</div>
<div class="two">
pink老师真帅
</div>
</div>
</body>
</html>
index.less
@import 'common';
body {
min-width: 320px;
width: 15rem;
margin: 0 auto;
line-height: 1.5;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
background: linear-gradient(to bottom right,rgba(80, 153, 148, .6), rgba(148, 97, 44,.6));
}
@baseFont: 50;
.banner {
width: 15rem;
height: 10rem;
background: url(../images/wy.jpg) no-repeat;
background-size: 100% auto;
background-position: 0 -6rem;
position: relative;
.content {
position: absolute;
display: flex;
justify-content: space-between;
align-items: center;
width: 12rem;
height: 5rem;
margin: 4rem 1.5rem 1rem;
padding: .5rem 1rem 1rem;
border-radius: 1rem;
background-color: rgba(255, 255, 255, .5);
box-sizing: border-box;
.info {
.pic {
float: left;
width: 2rem;
height: 2rem;
background: url(../images/tim.jpg) no-repeat;
background-size: 2rem 2rem;
border-radius: .2rem;
margin-right: 0.5rem;
}
.detail {
float: left;
width: 5rem;
height: 2rem;
// background-color: pink;
h