:not(selector) 選擇器的 CSS 的作用
使用 CSS :not(selector) 選擇器設定樣式,使該選擇器以外的每個元素都顯示指定的樣式。你可嘗試執行以下程式碼以實現 :not 選擇器
示例
<!DOCTYPE html>
<html>
<head>
<style>
p {
color: red;
}
:not(p) {
color: blue;
}
</style>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 語言
C++
C#
MongoDB
MySQL
Javascript
PHP