:checked
input:checked
選擇所有選中的表單元素
:disabled
input:disabled
選擇所有禁用的表單元素
:empty
p:empty
選擇所有沒有子元素的p元素
:enabled
input:enabled
選擇所有啟用的表單元素
:first-of-type
p:first-of-type
選擇每個父元素是p元素的第一個p子元素
:in-range
input:in-range
選擇元素指定范圍內(nèi)的值
:invalid
input:invalid
選擇所有無效的元素
:last-child
p:last-child
選擇所有p元素的最后一個子元素
:last-of-type
p:last-of-type
選擇每個p元素是其母元素的最后一個p元素
:not(selector)
:not(p)
選擇所有p以外的元素
:nth-child(n)
p:nth-child(2)
選擇所有p元素的第二個子元素
:nth-last-child(n)
p:nth-last-child(2)
選擇所有p元素倒數(shù)的第二個子元素
:nth-last-of-type(n)
p:nth-last-of-type(2)
選擇所有p元素倒數(shù)的第二個為p的子元素
:nth-of-type(n)
p:nth-of-type(2)
選擇所有p元素第二個為p的子元素
:only-of-type
p:only-of-type
選擇所有僅有一個子元素為p的元素
:only-child
p:only-child
選擇所有僅有一個子元素的p元素
:optional
input:optional
選擇沒有"required"的元素屬性
:out-of-range
input:out-of-range
選擇指定范圍以外的值的元素屬性
:read-only
input:read-only
選擇只讀屬性的元素屬性
:read-write
input:read-write
選擇沒有只讀屬性的元素屬性
:required
input:required
選擇有"required"屬性指定的元素屬性
:root
root
選擇文檔的根元素
news:target
選擇當(dāng)前活動#news元素(點擊URL包含錨的名字)
:valid
input:valid
選擇所有有效值的屬性
:link
a:link
選擇所有未訪問鏈接
:visited
a:visited
選擇所有訪問過的鏈接
:active
a:active
選擇正在活動鏈接
:hover
a:hover
把鼠標(biāo)放在鏈接上的狀態(tài)
:focus
input:focus
選擇元素輸入后具有焦點
:first-letter
p:first-letter
選擇每個<p> 元素的第一個字母
:first-line
p:first-line
選擇每個<p> 元素的第一行
:first-child
p:first-child
選擇器匹配屬于任意元素的第一個子元素的 <]p> 元素
:before
p:before
在每個<p>元素之前插入內(nèi)容
:after
p:after
在每個<p>元素之后插入內(nèi)容
:lang(language)
p:lang(it)
為<p>元素的lang屬性選擇一個開始值
屬性選擇器
[attribute]
用于選取帶有指定屬性的元素。
[attribute=value]
用于選取帶有指定屬性和值的元素。
[attribute~=value]
用于選取屬性值中包含指定詞匯的元素。
[attribute|=value]
用于選取帶有以指定值開頭的屬性值的元素,該值必須是整個單詞。
[attribute^=value]
匹配屬性值以指定值開頭的每個元素。
[attribute$=value]
匹配屬性值以指定值結(jié)尾的每個元素。
[attribute=value*]
匹配屬性值中包含指定值的每個元素。