水平导航栏
效果
代码目录:
代码
HTML代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>水平导航栏</title>
<link rel="stylesheet" href="../CSSFile/index.css" type="text/css">
</head>
<body>
<ul>
<li>
<a href="#" class="actvte">
<h3>
新的博文
</h3>
</a>
</li>
<li>
<a href="#">
<h3>
旧的博文
</h3>
</a>
</li>
<li>
<a href="#">
<h3>
日常吐槽
</h3>
</a>
</li>
<li class="about">
<a href="#" class="about">
<h3>
关于
</h3>
</a>
</li>
</ul>
</body>
</html>
CSS代码
ul
{
list-style-type: none;
margin: 0;
padding: 0;
overflow: auto;
background-color: #f8715f;
}
li
{
float: left;
}
li a
{
display: block;
color: #7347f8;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover:not(.actvte)
{
background-color: #f85b38;
}
.actvte
{
background-color: #f80815;
}
.about
{
float: right;
}
JS代码
/**
* 无
*/