用《前端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>Document</title>
<style>
a{
text-decoration: none;
width: 100px;
height: 50px;
display: inline-block;/*a标签行内元素,加宽高不生效,转成行内块元素*/
background-color: red;
color: white;
text-align: center;
line-height: 50px;
}
a:hover{
background-color: rgb(255, 145, 0);
}
</style>
</head>
<body>
<a href="#">导航1</a>
<a href="#">导航2</a>
<a href="#">导航3</a>
<a href="#">导航4</a>
<a href="#">导航5</a>
</body>
</html>