Home › Forums › CSS › id vs class › Reply To: id vs class
November 24, 2015 at 7:48 pm
#235200
Participant
Looking at your other question…
You should avoid targeting base html elements, ex footer.class
unless you have a very good reason.
If you’re interested in scoping try defining a parent class. I’ve forked your Pen
http://codepen.io/alenabdula/pen/vNwvVW
See when you use the just .class
for all intents and purposes it doesn’t matter what element you attach the class it will still behave as expected.
.parent {}
.parent .child {}
.parent .menu {}
<div class="parent">
<div class="child"></div>
<ul class="menu">
<li>List Item</li>
</ul>
</div>