在css中设置div的特定元素

时间:2010-06-23 13:52:37

标签: css html

我有一个名为mycontent的div。在这个div中有一个h2元素。此元素继承全局属性,但我想仅在mycontent div中更改其颜色。我宁愿不添加新类,因为我只想在css中操作。 我有类似的东西:

#mycontent {
position: absolute;
bottom: 15px;
left: 10px;


}

#mycontent h2 {
    color: #fff;

}

1 个答案:

答案 0 :(得分:1)

你的观点是什么?我的意思是,你已经拥有了正确的CSS来实现你所要求的。您编写的#mycontent h2 {}选择器是正确的:)