问题描述
|
我想知道有什么方法可以使下面的CSS示例正常工作吗?
<!DOCTYPE html>
<html>
<head>
<style type=\"text/css\">
.col p:first-child {
background:yellow;
}
</style>
</head>
<body>
<div class=\"col\">
<h1>Woot</h1>
<p>I am a super nun. I am a super nun.</p>
<p>I am a super nun. I am a super nun.</p>
</div>
</body>
</html>
基本上,我需要以某种方式设置元素的第一个<p>
样式,但是即使它是第二个孩子(duh),ѭ2 attempt也不起作用,即使我试图说:\“第一个<p>
元素在父母(例如.col p:first-child
)中”。
是否可以选择CSS中特定类型的第一个孩子而不是第一个孩子?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)