css3的新屬性選擇器
選擇器
~
設(shè)置同一父元素下的 div 元素之后的每一個(gè) p 元素的字體大小
div~p{
font-size:14px
}
[class^="test"]
設(shè)置class屬性值以"test"開(kāi)頭的所有div字體大小
div[class^="test"]{
font-size:14px
}
[class$="test"]
設(shè)置class屬性值以"test"結(jié)尾的所有div字體大小
div[class$="test"]{
font-size:14px
}
[class*="test"]
設(shè)置class屬性值以"test"所有div字體大小
div[class*="test"]{
font-size:14px
}
:first-of-type
選擇的 div 元素是其父元素的第一個(gè) div 元素
div:first-of-type{
font-size:14px
}
:last-of-type
選擇的 div 元素是其父元素的最后一個(gè) div 元素
div:last-of-type{
font-size:14px
}
:only-of-type
指定屬于父元素的特定類型的唯一子元素的div 元素
div:only-of-type{
font-size:14px
}
:only-child
指定屬于父元素的特定類型的唯一子元素的div 元素
div:only-child{
font-size:14px
}
:nth-child(n)
選擇每個(gè)div元素是其父級(jí)的第n個(gè)子元素
div:nth-child(n){
font-size:14px
}
:nth-last-child(n)
選擇每個(gè)div元素的是其父級(jí)的第n個(gè)子元素佛致,從最后一個(gè)子項(xiàng)計(jì)數(shù)
div:nth-last-child(n){
font-size:14px
}
:nth-of-type(n)
選擇每個(gè)div元素是其父級(jí)的第n個(gè)div元素
div:nth-of-type{
font-size:14px
}
:nth-last-of-type(n)
選擇每個(gè)div元素的是其父級(jí)的第n個(gè)div元素绵咱,從最后一個(gè)子項(xiàng)計(jì)數(shù)
div:nth-last-of-type{
font-size:14px
}
:last-child
選擇每個(gè)div元素是其父級(jí)的最后一個(gè)子級(jí)玻驻。
div:last-child{
font-size:14px
}
:root
選擇文檔的根元素
:root{
font-size:14px
}
:empty
選擇每個(gè)沒(méi)有任何子級(jí)的n元素(包括文本節(jié)點(diǎn))
n:empty{
font-size:14px
}
:target
選擇當(dāng)前活動(dòng)的n元素(包含該錨名稱的點(diǎn)擊的URL)
n:target{
font-size:14px
}
:enabled
選擇每一個(gè)已啟用的輸入元素)
n:enabled{
font-size:14px
}
:disabled
選擇每一個(gè)禁用的輸入元素
n:disabled{
font-size:14px
}
:checked
選擇每個(gè)選中的輸入元素
n:checked{
font-size:14px
}
:not(n)
選擇每個(gè)并非n元素的元素
:not(n){
font-size:14px
}
::selection
匹配元素中被用戶選中或處于高亮狀態(tài)的部分
::selection{
font-size:14px
}
:out-of-range
匹配值在指定區(qū)間之外的input元素
input:out-of-range{
font-size:14px
}
:in-range
匹配值在指定區(qū)間之內(nèi)的input元素
input:in-range{
font-size:14px
}
:read-only
用于匹配設(shè)置 "readonly"(只讀) 屬性的元素
input:read-only{
font-size:14px
}
:read-write
用于匹配可讀及可寫(xiě)的元素
input:read-write{
font-size:14px
}
:optional
用于匹配可選的輸入元素
input:optional{
font-size:14px
}
:vaild
用于匹配輸入值為合法的元素
input:vaild{
font-size:14px
}
:invaild
用于匹配輸入值為非法的元素
input:invaild{
font-size:14px
}