详解CSS3选择器的使用方法汇总

2020-04-30 14:45:59易采站长站整理
3:nth-last-child(n)p:nth-last-child(2)同上,从最后一个子元素开始计数。3:nth-of-type(n)p:nth-of-type(2)选择属于其父元素第二个 <p> 元素的每个 <p> 元素。3:nth-last-of-type(n)p:nth-last-of-type(2)同上,但是从最后一个子元素开始计数。3:last-childp:last-child选择属于其父元素最后一个子元素每个 <p> 元素。3:root:root选择文档的根元素。3:emptyp:empty选择没有子元素的每个 <p> 元素(包括文本节点)。3:target#news:target选择当前活动的 #news 元素。3:enabledinput:enabled选择每个启用的 <input> 元素。3:disabledinput:disabled选择每个禁用的 <input> 元素3:checkedinput:checked选择每个被选中的 <input> 元素。3:not(selector):not(p)选择非 <p> 元素的每个元素。3::selection::selection选择被用户选取的元素部分。3