Reputation: 3412
Look, i have the html below:
<body style="color:red;">
text inside 1
<p>
text inside p
...
</p>
<div class="divable1">
text inside div 1
</div>
</body>
and i want only "text inside 1" and "text inside p" to have color red BUT "text inside div 1" i want to ignore the style of the body element.
How is this possible with CSS?
Thank you in advance!
Upvotes: 2
Views: 2083
Reputation: 2325
I'm aware that this question was asked a very long time ago, but it could possibly be done by unsetting one or all properties:
body {
color: red;
}
.divable1 {
all: unset; /* resets everything */
color: unset; /* resets specific property */
}
Upvotes: 0
Reputation: 770
This is basic CSS hierarchy, you can't ignore the rules, but you can easily overwrite them:
body {
color: red;
}
.divable1 {
color: green;
}
Upvotes: 2
Reputation: 943571
There is no way to ignore rules in CSS, only to override them. Write a ruleset with:
.divable1
)color
property so it has a value other than the default, which is inherit
, such as color: black
. Upvotes: 4