css - When do I use class/id and when do I target the html tag directly -
hello ladies , gentlemen,
i have (another) question concerning html/css best practices. checked web , site came articles on when use ids , when use classes. however, that's not struggling with.
i know when use class selectors on html element selectors , vice versa.
example:
html
<div class="container"> <p class="nested-p">feefifem</p> </div> css option 1:
.nested-p{...} css option 2:
.container p{...} which option preferable under circumstances , why?
the first option .nested-p classes ( can put class html ,body , p ,div , aside etc --- - want.)
the second 1 p under .container ( yeah , that's right , p)
regarding priority - second 1 higher (read this )
why ?
becuase of :

a few pasted drawing (just emphasize)

so second 1 :

while first 1 like:

Comments
Post a Comment