1. 程式人生 > 其它 >4.[css基礎知識]知識點總結-導航欄

4.[css基礎知識]知識點總結-導航欄

1.前面所有知識點做一個小結

效果圖:

 

 

2.程式碼展示

<!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>

</head>
<style>
    body {
        font
-size:16px; } .nav { text-align: center; } .nav a { width: 120px; height: 50px; display: inline-block; line-height: 50px; text-decoration: none; background: url(images/bg.png) no-repeat; color:#fff; } .nav a:hover { background: url(images
/bgc.png); } </style> <body> <div class="nav"> <a href="#">首頁</a> <a href="#">首頁</a> <a href="#">首頁</a> <a href="#">首頁</a> <a href="#">首頁</a> <a href="#">首頁</a> </div> </body> </html>