选择器:first-of-type
收藏:0
阅读:54
CSS3 :first-of-type 选择器
实例
指定其父级的第一个p元素的背景色:
p:first-of-type
{
background:#ff0000;
}
{
background:#ff0000;
}
定义和用法
:first-of-type选择器匹配元素其父级是特定类型的第一个子元素。
提示: 和:nth-of-type(1)是一个意思。
Browser Support
所有主流浏览器都支持:first-of-type选择器。除了IE8和更早版本。