Reputation: 851
If I have this HTML
<p class="all">Example <span class="but">text</span> here.</p>
is it possible to write a simple CSS style to color the words Example
and here.
to red but leave the text
to default color?
Upvotes: 1
Views: 48
Reputation: 1323
not:- set a color for the span class but only
<style>
.all{ color:red;}
:not(but)({color:initial;}
</style>
<p class="all">Example <span class="but">text</span> here.</p>
Upvotes: 0
Reputation: 838
You can use color:initial property in css.
check the given below code snippet.
p{color:red}
.but{color:initial;}
<div>
<p class="all">Example <span class="but">text</span> here.</p>
</div>
Upvotes: 2