用HTML+css做既好看又實用的導航欄

導航欄

效果圖如下:
在這裏插入圖片描述
在這裏插入圖片描述
代碼如下:

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title></title>
	
	<style type="text/css">
			 ul{/*設置導航欄的框框*/
			 	margin: 30px auto;
				 width: 600px;
				 height: 350px;
				padding: 0px;
				
			}
			li{
				list-style-type: none;
				float: left;
			}
			a{
				display: block;
				width: 100px;
				height: 50px;
				font-family: Microsoft Yahei;
				line-height: 50px;
				background-color: crimson;
				margin: 0px 0px;
				color: #fff;
				text-align: center;
				text-decoration: none;
				font-size: 15px;
			}
			a:hover{
				background-color: #2f6f4f;
			}
		</style>
	
	
</head>
<body>
	<div >
			<ul class=daohanglan>
				<li><a href="">首頁</a></li>
				<li><a href="">圖書</a></li>
				<li><a href="">家電</a></li>
				<li><a href="">數碼</a></li>
				<li><a href="">服裝</a></li>
				<li><a href="">家居</a></li>
			</ul>
		</div>
</body>
</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章