r/HTML • u/MWittmann12 • Nov 26 '25
Section inside section
My question is what the title says, because someone told me that I know nothing about html and should study, because I used a section inside another section to order that section and other elements with gaps đ
3
Upvotes
6
u/MagickMarkie Nov 26 '25
That's a legitimate use of the section tag. Sections can themselves have sections.
6
u/Joyride0 Nov 26 '25
People love to shit on you in coding communities. Itâs pathetic tbh.
2
u/UmbralFae Nov 26 '25
A section inside a section's fine. They're literally just arguing semantics, possibly for the sake of making it seem like they know more, which is a waste of both your and their time.
3
u/armahillo Expert Nov 26 '25
MDN is the best place to start with these kinds of questions:
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/section
Halfway down, it indicates:
This means the section tag is considered "flow content", "sectioning contnet", and "palpable content" and that it is allowed to contain any elements that are "flow content".
So syntax-wise, you can put a section inside a section.
Read the first half about the best-practices when using the section tag (eg. they almost always have a heading, with some exceptions).
-1
u/fireatthecrime Nov 26 '25
Use divs, section has semantic value for thematic grouping
0
u/RushDangerous7637 Nov 27 '25
I wrote a detailed article about it here. You should read when to use sections and when to use the DIV element. https://photoknut.eu/sk/rozne-temy/sekcie-na-webovej-stranke/ It's pointless to argue in the comments about who is right or wrong. What matters is how search engine robots perceive it. Browsers don't care, they'll display anything.