“Sel first of type”的版本间差异

本页内容
上一节: Sel_attr_contain 下一节: Sel_last_of_type
(创建页面,内容为“{{DISPLAYTITLE::first-of-type}}5 = CSS3 :first-of-type 选择器 = 完整CSS选择器参考手册 选择的 p 元素是其父元素的第一个 p 元素: <sample title="" desc="" lang="html" hererun="1"> p:first-of-type { background:#ff0000; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> p:first-of-type { background:#…”)
 
Neo讨论 | 贡献
无编辑摘要
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
{{DISPLAYTITLE::first-of-type}}[[Category:css pseudo classes|5]]
{{DISPLAYTITLE::first-of-type}}[[Category:css selectors|28]]
= CSS3 :first-of-type 选择器 =
= CSS3 :first-of-type 选择器 =


第46行: 第46行:
{| class="table table-striped table-hover"
{| class="table table-striped table-hover"
! 选择器
! 选择器
!
! Chrome
!
! Internet Explorer / Edge
!
! Firefox
!
! Safari
!
! Opera
|-
|-
| :first-of-type
| :first-of-type

2022年8月19日 (五) 04:50的最新版本

CSS3 :first-of-type 选择器

完整CSS选择器参考手册

选择的 p 元素是其父元素的第一个 p 元素:


示例

p:first-of-type
{
    background:#ff0000;
}

定义和用法

first-of-type 选择器匹配元素其父级是特定类型的第一个子元素。

提示: 和 :nth-of-type(1) 是一个意思。

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号。

选择器 Chrome Internet Explorer / Edge Firefox Safari Opera
:first-of-type 4.0 9.0 3.5 3.2 9.6

完整CSS选择器参考手册

上一节: Sel_attr_contain 下一节: Sel_last_of_type
此页面最后编辑于2022年8月19日 (星期五) 04:50。