TypechoJoeTheme

Dcr163的博客

统计

CSS3 结构性伪类选择器—not

2017-03-09
/
0 评论
/
632 阅读
/
正在检测是否收录...
03/09

:not选择器称为否定选择器,和jQuery中的:not选择器一模一样,可以选择除某个元素之外的所有元素

例如:

在CSS编辑器的第五行输入代码,除页脚”div#page”之外的所有div设置橙色背景色。

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8">
<title>结构性伪类选择器—not</title>
<style>
    div{
        width:100px;
        height:100px;
    }
    div:not([id='page']){
        background:red;
    }
</style>
</head> 
<body>
    <div id="header">页头</div>
    <div id="page">页体</div>
    <div id="footer">页脚</div>
</body>
</html>


朗读
赞(0)
版权属于:

Dcr163的博客

本文链接:

http://dcr163.cn/119.html(转载时请注明本文出处及文章链接)

评论 (0)

人生倒计时

今日已经过去小时
这周已经过去
本月已经过去
今年已经过去个月

最新回复

  1. slot mpo terbaru
    2025-02-08
  2. Sherry Stockdill
    2025-01-28
  3. slot demo
    2025-01-13
  4. 陌天
    2025-01-09
  5. Kerrie Bostick
    2024-12-28

标签云