仿网易云页面
网易top
<!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>
<style>
body,
h1,
h2,
h3,
ul,
li {
margin: 0;
padding: 0;
}
body {
font: 12px Arial, Helvetica, sans-serif;
}
a {
text-decoration: none;
color: #000;
outline: none;
}
ul {
list-style-type: none;
}
input {
outline: none;
border: none;
}
.wrapper_01 {
width: 1100px;
margin: 0 auto;
}
.wrapper_02 {
width: 980px;
margin: 0 auto;
}
.topbar_sprite {
display: inline-block;
background-image: url("./images/topbar.png");
}
.topbar_icon_hot {
width: 28px;
height: 19px;
background-position: -190px 0;
}
.top {
height: 70px;
background-color: #242424;
box-sizing: border-box;
border-bottom: 1px solid #000;
}
.topbar {
display: flex;
justify-content: space-between;
height: 69px;
line-height: 69px;
}
.topbar .bar-left .logo {
background-image: url("./images/topbar.png");
background-position: no-repeat;
background-position: 0 0;
}
.topbar .bar-left {
display: flex;
}
.topbar .bar-left .logo a {
text-indent: -9999px;
width: 157px;
padding-right: 20px;
display: block;
}
.topbar .bar-left .list {
display: flex;
}
.topbar .bar-left .list .item {
position: relative;
display: block;
padding: 0 20px;
font-size: 14px;
color: #ccc;
}
.topbar .bar-left .list .item:hover,
.topbar .bar-left .list .item.active {
color: #fff;
background-color: #000;
}
.topbar .bar-left .list .item.active::after {
position: absolute;
content: "";
display: block;
width: 12px;
height: 7px;
left: 0;
right: 0;
bottom: -2px;
margin: 0 auto;
background: url("./images/topbar.png") -226px 0;
}
.topbar .bar-left .list .item .icon-hot {
position: absolute;
top: 14px;
right: -18px;
}
.topbar .bar-right {
display: flex;
align-items: center;
padding-right: 20px;
}
.topbar .bar-right .login a {
color: #787878;
}
.topbar .bar-right .login:hover a {
color: #ccc;
}
.topbar .bar-right .login a:hover {
color: #787878;
text-decoration: underline;
}
.topbar .bar-right .author a {
display: inline-block;
width: 90px;
height: 32px;
color: #ccc;
margin: 0 20px;
text-align: center;
box-sizing: border-box;
border: 1px solid #4f4f4f;
line-height: 32px;
border-radius: 20px;
}
.topbar .bar-right .author a:hover {
color: #fff;
border-color: #fff;
}
.topbar .bar-right .search {
display: flex;
justify-content: flex-end;
align-items: center;
width: 158px;
height: 32px;
box-sizing: border-box;
padding-right: 10px;
border-radius: 30px;
line-height: 32px;
background: #fff url("./images/topbar.png") 0 -99px;
}
.topbar .bar-right .search input {
font-size: 12px;
width: 112px;
}
.topbar .bar-right .search input::-webkit-input-placeholder {
color: #f00;
}
.topnav {
height: 35px;
line-height: 35px;
background-color: #c20c0c;
box-sizing: border-box;
border-bottom: 1px solid #a40011;
}
.navbar {
box-sizing: border-box;
padding-left: 180px;
}
.navbar .list {
display: flex;
}
.navbar .list .item span {
display: inline-block;
padding: 0 13px;
margin: 7px 17px;
color: #fff;
height: 20px;
line-height: 20px;
border-radius: 21px;
}
.navbar .list .item:hover span,
.navbar .list .item.active span {
background-color: #9b0909;
}
</style>
</head>
<body>
<div class="top">
<div class="topbar wrapper_01">
<div class="bar-left">
<h1 class="logo">
<a href="#">网易云音乐</a>
</h1>
<ul class="list">
<li><a href="#" class="item active">发现音乐</a></li>
<li><a href="#" class="item">我的音乐</a></li>
<li><a href="#" class="item">关注</a></li>
<li><a href="#" class="item">商城</a></li>
<li><a href="#" class="item">音乐人</a></li>
<li>
<a href="#" class="item"
>下载客户端
<i class="topbar_sprite topbar_icon_hot icon-hot"></i>
</a>
</li>
</ul>
</div>
<div class="bar-right">
<div class="search">
<input type="text" placeholder="音乐/视频/电台/用户" />
</div>
<div class="author"><a href="#">创作者中心</a></div>
<div class="login"><a href="#">登录</a></div>
</div>
</div>
</div>
<div class="topnav">
<div class="wrapper_01 navbar">
<!-- ul>(li>a[href=#].item)*6 -->
<ul class="list">
<li>
<a href="#" class="item active"><span>推荐</span></a>
</li>
<li>
<a href="#" class="item"><span>排行榜</span></a>
</li>
<li>
<a href="#" class="item"><span>歌单</span></a>
</li>
<li>
<a href="#" class="item"><span>主播电台</span></a>
</li>
<li>
<a href="#" class="item"><span>歌手</span></a>
</li>
<li>
<a href="#" class="item"><span>新碟商家</span></a>
</li>
</ul>
</div>
</div>
</body>
</html>
text-indent
<!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>
<style>
a {
/* 无效 */
/* text-indent: -9999px; */
display: block;
text-indent: -9999px;
}
</style>
</head>
<body>
<a href="#">coderbin</a>
</body>
</html>
line-height
<!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>
<style>
.box {
background-color: #f00;
color: #fff;
line-height: 50px;
}
</style>
</head>
<body>
<div class="box">哈哈哈哈</div>
<span class="box">哈哈哈哈</span>
</body>
</html>