导航栏
一、创建文件(index.html和style.css)
<!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>导航栏</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="top">
<ul class="daohang">
<li><a href="">首页</a></li>
<li><a href="">手机</a></li>
<li><a href="">家电</a></li>
<li><a href="">电脑</a></li>
<li><a href="">相册</a></li>
</ul>
</div>
</body>
</html>
body{
font-size:18px;
padding:0;
margin=0;
text-decoration:none;
}
li{
list-style:none;
}
a{
text-decoration:none;
}
img{
max-width:100%;
}
#top{
padding:10px 0;
width:100%;
background-color:#222
}
.daohang{
display:table;
width:100%;
padding:0;
}
.daohang li{
display:table-cell;
}
.daohang li>a{
display:block;
text-align:center;
color:white;
}
实现效果图: