1. 程式人生 > >CSS——水平(橫向滾動條)

CSS——水平(橫向滾動條)

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		ul {
			width: 200px;
			height: 100px;
			overflow-x: scroll;
			overflow-y: hidden;
			white-space:nowrap;  /* ul中的內容不換行 */
		}
		ul li {
			display: inline-block;
		}
	</style>
</head>
<body>
	<ul>
		<li>
			<img src="images/p_small_001.jpg" alt="">
		</li>
		<li>
			<img src="images/p_small_002.jpg" alt="">
		</li>
		<li>
			<img src="images/p_small_003.jpg" alt="">
		</li>
		<li>
			<img src="images/p_small_004.jpg" alt="">
		</li>
	</ul>
</body>
</html>