<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.nav {
height: 41px;
border-top: 3px solid #ff8500;
border-bottom: 1px solid #edeef0;
background-color: #fcfcfc;
/* 文字居中 */
line-height: 41px;
}
.nav a {
font-size: 12px;
color: #4c4c4c;
text-decoration: none;
/* 将a 行内元素转换为行内块元素, 方便设置高度*/
display: inline-block;
height: 41px;
/* 内边距左右20 */
padding: 0px 20px;
}
/*链接变色,伪类 */
.nav a:hover {
color: orange;
background-color: #eee;
}
</style>
</head>
<body>
<div class = "nav">
<a href="#">新浪导航</a>
<a href="#">手机新浪网</a>
<a href="#">客户端</a>
<a href="#">微博</a>
</div>
</body>
</html>
padding 案例
最新推荐文章于 2024-08-12 09:24:46 发布