?
?
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="./node_modules/_@fortawesome_fontawesome-free@6.0.0@@fortawesome/fontawesome-free/css/all.css">
<link rel="stylesheet" href="./index.css">
</head>
<body>
<!--移动端布局-->
<div id="top">
<div>
<ul>
<li></li>
<li></li>
</ul>
</div>
<div>
<i class="pingguo fab fa-apple fa-xs"></i>
</div>
<div>
<i class="fas fa-shopping-bag fa-xs"></i>
</div>
</div>
<!--pc端布局-->
<div id="mobile">
<ul>
<li>
<i class="pingguo fab fa-apple fa-xs"></i>
</li>
<li>商店</li>
<li>Mac</li>
<li>iPad</li>
<li>Watch</li>
<li>AirPods</li>
<li>家居</li>
<li>Apple独家</li>
<li>配件</li>
<li>技术支持</li>
<li>
<i class="fas fa-search fa-xs"></i>
</li>
<li>
<i class="fas fa-shopping-bag fa-xs"></i>
</li>
</ul>
</div>
<div id="message">
<div><a href="#">在线选购</a>
,享受免费送货、Specialist 专家支持、免息分期等服务</div>
</div>
<div id="ad">
<img/>
</div>
</body>
</html>
<!--
img src="https://empic.dfcfw.com/863614397355180033/w368h744/art"/>
https://pics7.baidu.com/feed/960a304e251f95ca6092129087137b34670952bb.jpeg?token=a4d104d06323329964ff727875119db2
-->
?
less文件:
*{
padding: 0;
margin: 0;
a{
text-decoration: none;
}
ul{
list-style-type:none;
}
}
#mobile{
position: sticky;
top: 0;
background-color: black;
padding:0 18px;
ul{
width: 100%;
display: flex;
justify-content: space-around;
align-items: center;
li:nth-child(1),
li:nth-child(11),
li:nth-child(12){
line-height: 48px;
font-size: 28px;
i{
color:white;
width: 33px;
display: block;
height: 48px;
line-height: 48px;
}
}
li{
color:white;
font-size: 12px;
}
}
}
#top{
position: sticky;
top: 0;
background-color: black;
padding:0 18px;
display: flex;
justify-content: space-between;
align-items: center;
div{
height: 48px;
line-height: 48px;
}
div:nth-child(1){
width:48px;
ul{
display: flex;
flex-direction: column;
height: 48px;
justify-content: center;
list-style-type: none;
li:nth-child(1){
border-top: 1px solid white;
}
li{
line-height: 48px;
width: 15px;
border-bottom: 1px solid white;
padding: 3px;
margin-bottom: 1px;
}
}
}
div:nth-child(2), div:nth-child(3){
line-height: 48px;
font-size: 28px;
i{
color:white;
width: 33px;
display: block;
height: 48px;
line-height: 48px;
}
}
}
#message{
display: flex;
align-items: center;
width: 100%;
background-color: #f5f5f7;
font-size: 10px;
height: 61.16px;
text-align: center;
color: #8b8b8d;
div{
margin: auto;
padding:0 24px;
}
}
@media (max-width:303px){
#message{
width: 303px;
}
}
@media (max-width:734px){
#top{
display: flex;
}
#mobile{
display: none;
}
#ad{
img{
width: 100%;
content: url('https://empic.dfcfw.com/863614397355180033/w368h744/art');
background-size:cover;
}
}
}
@media (max-width:1400px) and (min-width:735px){
#top{
display: none;
}
#mobile{
display: flex;
}
#ad{
img{
width:735px;
display: block;
margin: auto;
content: url('https://mms1.baidu.com/it/u=1127784663,1190904074&fm=253&app=120&f=JPEG&fmt=auto&q=75?w=660&h=470');
background-size:cover;
}
}
}
|