css中关于first-child的问题p:first-child{color:blue;} This is some text.This is some text.Note:For :first-child to work in IE8 and earlier,a DOCTYPE must be declared.p:first-child{color:blue;},
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/05 17:31:32
css中关于first-child的问题p:first-child{color:blue;} This is some text.This is some text.Note:For :first-child to work in IE8 and earlier,a DOCTYPE must be declared.p:first-child{color:blue;},
css中关于first-child的问题
p:first-child
{
color:blue;
}
This is some text.
This is some text.
Note:For :first-child to work in IE8 and earlier,a DOCTYPE must be declared.
p:first-child{color:blue;},
css中关于first-child的问题p:first-child{color:blue;} This is some text.This is some text.Note:For :first-child to work in IE8 and earlier,a DOCTYPE must be declared.p:first-child{color:blue;},
您好:这句的意思就是:给p标签中的第一个子元素的字体颜色设置为蓝色.匹配条件:①有子元素的P标签.②第一个子元素.
给你举几个例子:
例子 1 - 匹配第一个
元素
在下面的例子中,选择器匹配属于任意元素的第一个子元素的
元素:
p:first-child
{
font-weight:bold
}
I am a strong man. I am a strong man.
I am a strong man. I am a strong man.
例子 2 - 匹配所有
元素中的第一个 元素
在本例中,选择器匹配属于
元素中的第一个子元素的 元素:
p > em:first-child
{
font-weight:bold
}
I am a strong man. I am a strong man.
I am a strong man. I am a strong man.
例子 3 - 匹配所有第一个子元素
元素中的所有 元素
在下面的例子中,选择器匹配属于其他元素的第一个子元素的
元素中的所有 :
p:first-child em
{
font-weight:bold
}
I am a strong man. I am a strong man.
I am a strong man. I am a strong man.