Search code examples
htmlsemantics

Are these HTML tags semantically correct?


I'm starting at web development and want to divide the content of one page in 2 columns, but I'm not sure if the following HTML semantics are correct.

<body>
<div class="left">
<section>
<h2>One</h2>
<img ...>
</section>
<section>
<h2>Two</h2>
<img...>
</section>
</div>
<div class="right">
<section>
<h2>Image related to those of the other div</h2>
<img...>
</section>
</div>
</body>

Solution

  • In any case your page is missing an h1 tag, which is essential for semantics, SEO and accessibility!

    The rest, for the described purpose of presenting some images, seems okay. You wouldn't necessarily have to use section tags, though – the h2 tags are enough to organize them as images with related headers. But if those parts of the page are really thematically different, sections are a good way to emphasize that.