实现右对齐导航链接
实例代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
ul{
list-style-type:none;
margin:0;
padding:0;
overflow:hidden;
width:500px;
background-color:#333;
}
li{
float:left;
}
li a {
display:block;
color:white;
padding:10px;
text-align:center;
text-decoration:none;
}
li a:hover:not(.active){
background-color:#111;
}
.active{
background-color:#4caf50;
}
</style>
</head>
<body>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Contact</a></li>
<li style="float:right"><a class="active" href="#">About</a></li>
</ul>
</body>
</html>
运行效果:
评论