Hi guys!
I have a question about best practices. I know it's usually recommended to use a CSS class selector .myclass
instead of an id selector #myelement
or an element selector div
.
However, I was wondering, is it better to create a class even if we won't reuse it? For example:
<body> <section> <p class="myparagraph"></p> </section> <section></section> <section></section> <section></section> </body>
If I want to style the paragraph, is it best practice to delete its class in the html and do:
p { color: blue; }
OR this:
section p { color: blue; }
OR do I keep the class of the paragraph (even if it won't be reused) and do:
.myparagraph { color: blue; }
Thanks and happy coding :)