200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > css first-child CSS :first-child 伪类

css first-child CSS :first-child 伪类

时间:2018-08-29 20:45:34

相关推荐

css first-child CSS :first-child 伪类

实例

例子 1 - 匹配第一个

元素

在下面的例子中,选择器匹配属于任意元素的第一个子元素的

元素:

p:first-child

{

font-weight:bold

}

I am astrongman. I am astrongman.

I am astrongman. I am astrongman.

例子 2 - 匹配所有

元素中的第一个元素

在本例中,选择器匹配属于

元素中的第一个子元素的元素:

p > em:first-child

{

font-weight:bold

}

I am astrongman. I am astrongman.

I am astrongman. I am astrongman.

例子 3 - 匹配所有第一个子元素

元素中的所有元素

在下面的例子中,选择器匹配属于其他元素的第一个子元素的

元素中的所有:

p:first-child em

{

font-weight:bold

}

I am astrongman. I am astrongman.

I am astrongman. I am astrongman.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。