<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>新浪导航栏</title>
<style>
.nav {
border-top: 3px solid #ff8500;
border-bottom: 1px solid #edeef0;
line-height: 41px;
background-color: #fcfcfc;
}
.nav a {
display: inline-block;
height: 41px;
/*a要转换成行内块元素*/
padding: 0 20px;
color: #4c4c4c;
font-size: 12px;
text-decoration: none;
}
.nav a:hover {
background-color: #eee;
color: #ff8500;
}
</style>
</head>
<body>
<div class="nav"><a href="#">新浪导航</a>
<a href="#">手机新浪网</a>
<a href="#">移动客户端</a>
<a href="#">微博</a>
<a href="#">三个字</a>
</div>
</body>
</html>
效果图
注意:a一定要转换为行内块元素!!!!
凭借肌肉记忆,终于记得格式化代码为shift+alt+f