手機端實現動態響應頁面寬度,變換不同的樣式

<html>
	<head>
		<title>標題</title>
	</head>
	<body>
		<style>
			#box{width:500px;height:100px;background:yellow;}
			
			@media screen and  (min-width: 960px) and (max-width: 1199px) {			 
				#box {
					width:960px;
					height:500px;
					background:red;
				}
			}
			
			@media screen and  (min-width: 500px) and (max-width: 960px) {
				#box {
					width:660px;
					background:green;
					height:500px;
				}
			}
			
			@media screen and  (min-width: 300px) and (max-width: 500px) {
				#box {
					width:660px;
					background:coffee;
					height:500px;
				}
			}
		</style>
		<div id="box"> </div>
	</body>
</html>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章