IT入门 > 教程 >
  • CSS3 :first-of-type 选择器 日期:2022-10-10 点击:2220 css教程

    实例 选择的 p 元素是其父元素的第一个 p 元素: p:first-of-type{ background:#ff0000;} 尝试一下 » 定义和用法 :first-of-type 选择器匹配元素其父级是特定类型的第一个子元素。 提示: 和 :nth-of-...

  • CSS :in-range 选择器 日期:2022-10-10 点击:899 css教程

    实例 输入的值在指定区间内时,设置指定样式: input:in-range{ border:2px solid yellow;} 尝试一下 » 定义和使用 :in-range 选择器用于标签的值在指定区间值时显示的样式。 注意: :in-range 选择器...

  • CSS :invalid 选择器 日期:2022-10-10 点击:3663 css教程

    实例 如果 input 元素中的值是非法的,设置样式为红色: input:invalid{ border:2px solid red;} 尝试一下 » 定义和使用 :invalid 选择器用于在表单元素中的值是非法时设置指定样式。 注意: :in...

  • CSS3 :last-child 选择器 日期:2022-10-10 点击:4547 css教程

    实例 指定父元素中最后一个p元素的背景色: p:last-child{ background:#ff0000;} 尝试一下 » 定义和用法 :last-child 选择器用来匹配父元素中最后一个子元素。 提示: p:last-child 等同于 p:nth-last-c...

  • CSS3 :last-of-type 选择器 日期:2022-10-10 点击:5024 css教程

    实例 指定其父级的最后一个p元素的背景色: p:last-of-type{background:#ff0000;} 尝试一下 » 定义和用法 :last-of-type选择器匹配元素其父级是特定类型的最后一个子元素。 提示: 和:nth-last-of-ty...

  • CSS3 :not 选择器 日期:2022-10-10 点击:6353 css教程

    实例 为每个并非p元素的元素设置背景颜色: :not(p){background:#ff0000;} 尝试一下 » 定义和用法 :not(selector) 选择器匹配每个元素是不是指定的元素/选择器。 浏览器支持 表格中的数字表示支...

  • CSS3 :nth-child() 选择器 日期:2022-10-10 点击:5268 css教程

    实例 指定每个 p 元素匹配的父元素中第 2 个子元素的背景色: p:nth-child(2){ background:#ff0000;} 尝试一下 » 定义和用法 :nth-child(n) 选择器匹配父元素中的第 n 个子元素,元素类型没有限制。...

  • CSS3 :nth-last-child() 选择器 日期:2022-10-10 点击:8709 css教程

    实例 指定每个 p 元素匹配同类型中的倒数第 2 个同级兄弟元素背景色: p:nth-last-child(2){ background:#ff0000;} 尝试一下 » 定义和用法 :nth-last-child(n) 选择器匹配属于其元素的第 N 个子元素的...

  • CSS3 :nth-last-of-type() 选择器 日期:2022-10-10 点击:6829 css教程

    实例 指定每个p元素匹配同类型中的倒数第2个同级兄弟元素背景色: p:nth-last-of-type(2){background:#ff0000;} 尝试一下 » 定义和用法 :nth-last-of-type( n )选择器匹配同类型中的倒数第n个同级兄弟...

  • CSS3 :nth-of-type() Selector 日期:2022-10-10 点击:7651 css教程

    实例 指定每个p元素匹配同类型中的第2个同级兄弟元素的背景色: p:nth-of-type(2){background:#ff0000;} 尝试一下 » 定义和用法 :nth-of-type(n)选择器匹配同类型中的第n个同级兄弟元素。 n可以是...