4.1否定伪类选择器

91 阅读1分钟
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		/* 否定伪类选择器 从某类元素中剔除一些元素 */
		p:not(.p2){
			background-color: red;
		}
	</style>
</head>
<body>
	<p>段落标签</p>
	<p class="p2">段落标签</p>
	<p>段落标签</p>
	<p>段落标签</p>
</body>
</html>