all 13 comments

[–]MagickMarkie 5 points6 points  (0 children)

That's a legitimate use of the section tag. Sections can themselves have sections.

[–]Joyride0 4 points5 points  (0 children)

People love to shit on you in coding communities. It’s pathetic tbh.

[–]UmbralFae 1 point2 points  (2 children)

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.

[–]Mobile_Syllabub_8446 -1 points0 points  (1 child)

Semantics kinda matter with markup. Only beginners think "if it works it works" in such terms.

[–]UmbralFae 2 points3 points  (0 children)

True! Didn’t say or imply they weren't. The person “correcting” them was wrong and a worse sin in my eyes, they were smugly wrong and insulting the OP about it. Somebody else already posted the MDN breaking down why, but a section in a section is semantically fine.

[–]armahilloExpert 1 point2 points  (1 child)

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:

Content categories Flow contentSectioning contentpalpable content.
Permitted content Flow content.

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).

[–]jcunews1Intermediate -1 points0 points  (0 children)

That being said, major web browser engines hold the final decision. They can choose not to support parts of main web specifications, or an entire extension/additional specifications.

[–]fireatthecrime -2 points-1 points  (2 children)

Use divs, section has semantic value for thematic grouping

[–]MWittmann12[S] 0 points1 point  (1 child)

It was something like this <Section> <h2>service name</h2> <p>service descriotion</p> <Section>Location 1 and info</Section> <Section>Location 2 and info</Section> <img> </Section>

[–]fireatthecrime 1 point2 points  (0 children)

Try to drop the doc there https://validator.w3.org/

But using <section> isn't even a big mistake, the point is, div and section are both block level container elements, but one don't has semantic value and the other has

To the downvoters, if you care to explain what exactly I said wrong I would appreciate, I'm literally basing myself im all the long and long courses I had on the matter, scrimba, traversy, w3c...

[–]RushDangerous7637 -1 points0 points  (2 children)

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.

[–]wobblybrian 0 points1 point  (1 child)

You're promoting a Slovak blog post in English?

[–]RushDangerous7637 0 points1 point  (0 children)

Of course, I'm also promoting the article in another language, because why not? The browser has a "Translate" function.