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/06/27 12:55:09
![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;},](/uploads/image/z/9289419-51-9.jpg?t=css%E4%B8%AD%E5%85%B3%E4%BA%8Efirst-child%E7%9A%84%E9%97%AE%E9%A2%98p%3Afirst-child%7Bcolor%3Ablue%3B%7D+This+is+some+text.This+is+some+text.Note%3AFor+%3Afirst-child+to+work+in+IE8+and+earlier%2Ca+DOCTYPE+must+be+declared.p%3Afirst-child%7Bcolor%3Ablue%3B%7D%2C)
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.