[QUESTION] Having several divs in the HTML template

I have a question. Just a theory in mind, is it ‘ethical’ to have several divs in the HTML template? Let’s say I have several sections in a webpage and I’ll render those in different JS files?

(Please refer to the sample below if it’s not clear)

<html lang="en">
    <title>Some title</title>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="apple"></div>
    <div id="coconut"></div>
    <div id="whatever"></div>
                      <!--Like here, I have several divs (which correspond to
                           sections of a page then I'll render these in different files let's say.
                           Would this be an 'ethical'/'professional' practice?
                           What would be the ups and downs?


Yes, it is completely normal to have many divs into one section. It all depends on the use case. There is no pitfall with regard to having many divs in your code. If you’re comfortable segmenting as much as you can, please feel free to use divs as much as you can.


1 Like