支援CSS3 以上 用法::not(selector) 說明: not(selector) 那些不要套用樣式 css定義: 是a tag 不要套用樣式 :not(a){ font-size: 30px; color: red; } 注意事項: 程式: <!DOCTYPE html> <html> <head> <title>css3 Selector not(selector) 套用樣式</title> <meta http-equiv="Content-Type" content="text/html; charset=BIG5"> <style type="text/css"> a{ font-size: 20px; color: silver; } :not(a){ font-size: 30px; color: red; } </style> </head> <body> <a href="#1">a tag test 1</a> <div> <a href="#2">a tag test 2</a> <a href="#3">a tag test 3</a> <p>p tag test 1</p> </div> <a href="#4">a tag test 4</a> <p>p tag test 2</p> </body> </html> 圖1:
測試結束~ 如果還不了解可參考:w3schools CSS Selector Reference 感謝~
文章標籤
全站熱搜
