一個簡單的導航欄
阿新 • • 發佈:2021-01-20
技術標籤:前端技術
練習目的:
使用 垂直居中 水平對齊方法
使用a標籤的行內塊模式水平佈局
實現效果:
實現程式碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Navbar</title>
<style>
.navbar-item{
display: inline-block;
width : 100px;
height: 30px;
background-color: pink;
text-align: center;
line-height: 30px;
color: white;
text-decoration: none;
}
.navbar-item:hover{
background-color: orange;
color: yellow;
}
</style>
</head>
<body>
<div class="navbar">
<a href="" class="navbar-item">新聞</a>
<a href="" class="navbar-item">體育</a>
<a href="" class="navbar-item">汽車</a>
</div>
</body>
</html>