34 lines
946 B
HTML
34 lines
946 B
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>12_伪类选择器_否定伪类</title>
|
||
<style>
|
||
/* 选择的是div的儿子p元素,但是排除类名为fail的元素 */
|
||
/* div>p:not(.fail) {
|
||
color: red;
|
||
} */
|
||
/* 选择的是div的儿子p元素,但是要排除title属性以“你要加油”开头的*/
|
||
/* div>p:not([title^="你要加油"]) {
|
||
color: red;
|
||
} */
|
||
div>p:not(:first-child) {
|
||
color: red;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<div>
|
||
<p>张三: 98分</p>
|
||
<p>李四: 88分</p>
|
||
<p>王五: 78分</p>
|
||
<p>赵六: 68分</p>
|
||
<p class="fail" title="你要加油啊! 孙七">孙七: 58分</p>
|
||
<p class="fail" title="你要加油啊! 老八">老八: 48分</p>
|
||
</div>
|
||
</body>
|
||
|
||
</html> |