1. 程式人生 > >CSS 垂直滾動選單

CSS 垂直滾動選單

<!DOCTYPE html >
<html>
	<head>
		<meta charset="utf-8"> 
		<title>自學教程(如約智惠.com)</title> 
		<style >
			.vertical-menu {
				width:200px;
				height:150px;
				overflow-y:auto;
			}
			
			.vertical-menu a {
				background-color:#eee;
				color:black;
				display:block;
				padding:12px;
				text-decoration:none;
			}
			
			.vertical-menu a:hover {
				background-color:#ccc;
			}
			
			.vertical-menu a.active {
				background-color:#4ACF50;
				color:white;
			}
			
			
		</style>
	</head>
	<body >
		<h1>垂直滾動選單</h1>

		<div class="vertical-menu">
		  <a href="#" class="active">Home</a>
		  <a href="#">Link 1</a>
		  <a href="#">Link 2</a>
		  <a href="#">Link 3</a>
		  <a href="#">Link 4</a>
		  <a href="#">Link 5</a>
		  <a href="#">Link 6</a>
		  <a href="#">Link 7</a>
		  <a href="#">Link 8</a>
		  <a href="#">Link 9</a>
		  <a href="#">Link 10</a>
		</div>
	</body>
</html>