分享一个跳动的导航,喜欢的可以收藏哦!
效果展示:
1615984801766
HTML结构
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>跳动的导航</title>
<link rel="stylesheet" href="css/pubilc.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- 导航 -->
<div class="nav">
<ul>
<li>
<a href="#" target="_blank">
<span class="website">官网首页</span>
<span class="home">HOME</span>
</a>
</li>
<li>
<a href="#" target="_blank">
<span class="website">游戏资料</span>
<span class="home">GAME INFO</span>
</a>
</li>
<li>
<a href="#" target="_blank">
<span class="website">商城合作</span>
<span class="home">STORE</span>
</a>
</li>
<li>
<a href="#" target="_blank">
<span class="website">用户互动</span>
<span class="home">COMMUNITY</span>
</a>
</li>
<li>
<a href="#" target="_blank">
<span class="website">赛事中心</span>
<span class="home">EVENTS</span>
</a>
</li>
<li>
<a href="#" target="_blank">
<span class="website">自助系统</span>
<span class="home">SYSTEM</span>
</a>
</li>
<li>
<a href="#" target="_blank">
<span class="website">个人中心</span>
<span class="home">USER CENTER</span>
</a>
</li>
</ul>
</div>
<!-- 导航end -->
</body>
</html>
css样式
@charset "utf-8";
.nav{
width: 1200px;
height: 76px;
position: relative;
background: #000;
margin-left: auto;
margin-right: auto;
}
.nav ul{
display: flex;
justify-content: space-between;
}
.nav ul a{
padding-left: 30px;
padding-right: 30px;
height:76px;
line-height:76px ;
display: block;
text-align: center;
overflow: hidden; /*隐藏英文字*/
}
.nav ul a span{
display: block;
}
.nav ul li a:hover{
background: #e45717;
}
.nav ul li a .website{
font-size: 20px;
color: #fff;
text-align: center;
transition: all 0.5s;
}
.nav ul li a .home {
font-size: 16px;
color: #6b6a46;
text-align: center;
}
.nav ul a:hover .website{ /*鼠标移上去让英文字体上移,而中文字隐藏*/
margin-top: -76px;
}