+ 1

Is it okay to style a <section> tag or should I nest a <div>?

I want to know what is the best or common practice in a case like the following: I'm using a section tag to target a cards section on my page, but is it okay if I give it a class and maybe style it's background, set some padding, etc...? or should I nest a div within the section and start the styling from there? <section id="cards-section" class="pink-background"> <h1>...</h1> <p>...</p> </section> <section id="cards-section"> <div class="pink-background"> <h1>...</h1> <p>...</p> </div> </section>

25th Jun 2020, 5:13 AM
Paco Chamorro-Fierro
Paco Chamorro-Fierro - avatar
1 Odpowiedź
+ 1
Yes, Its totally fine to style the section. You can also style both the section and the inner div, no problems whatsoever
25th Jun 2020, 7:31 AM
Domenique
Domenique - avatar