我正在解决与CSS的问题,我有一个继承问题。css using:not()on inheritance class
其实,我的代码如下所示:
HTML
<div class="title-in-green">
<h1> my title</h1>
</div>
CSS
.div {color : #00FF00;}
.h1 {color : #FF0000; other text size...}
问题:我的h1
文本是红色。
正常,我已经设置了这种方式...但我想它绿色,我不能更改h1
CSS。
所以我使用try :not()
功能CSS:
.div {color : #00FF00;}
.h1:not(.title-in-green) {other text size...} //if i have a div surrounding my h1, wanting the text green
.h1(.title-in-green) {color : #FF0000; other text size...} //if not, h1 is red
不能正常使用,正常H1是不是title-in-green
类...
我试过:not(div.title-in-green)
,但它不工作太...
我不明白我该如何设置,并且我问你一点帮助。
提前,thx。
在CSS一期,是指类,所以'.div'查找与'类元素=“div”',而不是div。删除期间。 – j08691