效果图
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximun-scale=1.0,user-scalable=0">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/index.css">
<title>苏宁首页案例</title>
</head>
<body>
<!-- 顶部搜索框模块---------------start -->
<div class="search-content">
<a href="#" class="classify"></a>
<div class="search">
<form action="">
<input type="search" placeholder="厨卫保暖季 每千减百">
</form>
</div>
<a href="#" class="login">登录</a>
</div>
<!-- 顶部搜索框模块-------------------end -->
<!-- banner模块----------------------start -->
<div class="banner">
<img src="upload/banner.gif" alt="">
</div>
<!-- banner模块-------------------------end -->
<!-- 广告部分---------------------------start -->
<div class="ad">
<a href="#">
<img src="upload/ad1.gif" alt="">
</a>
<a href="#">
<img src="upload/ad2.gif" alt="">
</a>
<a href="#">
<img src="upload/ad3.gif" alt="">
</a>
</div>
<!-- 广告部分----------------------------end -->
<!-- nav模块-----------------------------start -->
<nav>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
<a href="#">
<img src="upload/nav1.png" alt="">
<span>爆款手机</span>
</a>
</nav>
<!-- nav模块-------------------------------end -->
</body>
</html>
CSS
html {
font-size: 50px;
}
a {
text-decoration: none;
}
@media screen and (min-width: 320px) {
html {
font-size: 21.33333333px;
}
}
@media screen and (min-width: 360px) {
html {
font-size: 24px;
}
}
@media screen and (min-width: 375px) {
html {
font-size: 25px;
}
}
@media screen and (min-width: 384px) {
html {
font-size: 25.6px;
}
}
@media screen and (min-width: 400px) {
html {
font-size: 26.66666667px;
}
}
@media screen and (min-width: 414px) {
html {
font-size: 27.6px;
}
}
@media screen and (min-width: 424px) {
html {
font-size: 28.26666667px;
}
}
@media screen and (min-width: 480px) {
html {
font-size: 32px;
}
}
@media screen and (min-width: 540px) {
html {
font-size: 36px;
}
}
@media screen and (min-width: 720px) {
html {
font-size: 48px;
}
}
@media screen and (min-width: 750px) {
html {
font-size: 50px;
}
}
body {
min-width: 320px;
width: 15rem;
margin: 0 auto;
line-height: 1.5;
font-family: Arial, Helvetica;
background: #f2f2f2;
height: 2000px;
}
.search-content {
display: flex;
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 15rem;
height: 1.76rem;
background-color: #ffc001;
}
.search-content .classify {
width: 0.88rem;
height: 1.4rem;
margin: 0.22rem 0.5rem 0.14rem 0.48rem;
background: url(../image/classify.png) no-repeat;
background-size: 0.88rem 1.4rem;
}
.search-content .search {
flex: 1;
}
.search-content .search input {
border: 0;
outline: none;
width: 100%;
height: 1.32rem;
border-radius: 0.66rem;
margin-top: 0.22rem;
background-color: #fff2cc;
font-size: 0.5rem;
padding-left: 1.1rem;
color: #757575;
}
.search-content .login {
width: 1.5rem;
height: 1.4rem;
margin: 0.2rem;
font-size: 0.5rem;
color: #fff;
text-align: center;
line-height: 1.4rem;
}
.banner {
width: 15rem;
height: 7.36rem;
}
.banner img {
width: 100%;
height: 100%;
}
.ad {
display: flex;
}
.ad a {
flex: 1;
}
.ad a img {
width: 100%;
height: 100%;
}
nav {
width: 15rem;
height: 5.6rem;
}
nav a {
float: left;
width: 3rem;
height: 2.8rem;
text-align: center;
}
nav a img {
display: block;
width: 1.64rem;
height: 1.64rem;
margin: 0.2rem auto -0.34rem;
}
nav a span {
font-size: 0.5rem;
color: #333;
}