移动优先,默认你是用手机浏览该网页的,当你用pc浏览时,就会以min-width进行递增式媒体查询

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		.wap {
			font-size: 20px;
		}
		@media only screen and (min-width: 300px) {
			.wap {
				font-size: 40px;
			}
		}
		@media only screen and (min-width: 700px) {
			.wap {
				font-size: 60px;
			}
		}
	</style>
</head>
<body>
	<p class="wap">移动优先</p>
</body>
</html>

pc优先与之相反,默认你是用pc浏览该网页,当屏幕缩小时以max-width递减式进行媒体查询

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		.pc {
			font-size: 60px;
		}
		@media only screen and (max-width: 700px) {
			.pc {
				font-size: 40px;
			}
		}
		@media only screen and (max-width: 300px) {
			.pc {
				font-size: 20px;
			}
		}
	</style>
</head>
<body>
	<p class="pc">pc优先</p>
</body>
</html>

相关文章:

  • 2021-09-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-09
  • 2022-03-03
相关资源
相似解决方案