Lets say I have the following markup:-
<div class="house">
<p>...</p>
<div class="room">
<p>...</p>
</div>
</div>
<div class="house">
<p>...</p>
<div class="room porch">
<p>...</p>
</p>
</div>
CSS:-
.house .room { /* Some styling done here */ }
.porch { /* Some different styling done here */ }
Now, I'd like my div with the classes room
and porch
to consider only the class porch
and ignore the styles of house
and room
. Is this possible? This is just a simple example, I have a case where in place of the class porch
, there are many more classes, so overriding just one class with !important
won't work, as there could be a lot of classes with various styles.
How can this be achieved?