Semantic-html, article-and-section

In the lesson on HTML semantics, we’re introduced to the , and tags amongst others.
Rather than using tags, can’t one use the

tag instead?
Secondly, rather than making the tag a child of the tag, wouldn’t it be preferable to use the

tag as the child?

https://www.codecademy.com/journeys/full-stack-engineer/paths/fscj-22-web-development-foundations/tracks/fscj-22-fundamentals-of-html/modules/wdcp-22-semantic-html-44fa9550-9f1e-49de-b4d6-295acba84038/lessons/semantic-html/exercises/article-and-section

Being as there are no hard and fast rules in HTML, and given that it all hinges around a set of recommendations and guidelines, the only thing that one can deem ‘preferable’ is well-formedness and validation, as well as meeting with the third level of WAI-WCAG and any that are recommended by WHATWG.

We should also note that there is a difference between a ‘tag’ and an ‘element’.

<p>  =>  OPENTAG
</p> =>  ENDTAG

<p>...</p>  =>  element

The very worst thing one can do when learning HTML is to see it as governed by rules, which as stated above, it is not. In other words, don’t start narrowing your options with imaginary or arbitrary rules or preferences. Keep an open mind and think, ‘structure’ and ‘outline’.

The choice of elements used is based upon what we want the structure to tell a reader of the markup. Semantic elements are intended to assist in that process with a little more clarity, not to be confused with specificity.

Thanks immensely. Versatility is like a virtue to HTML. Your contributions in other topics too are quite enlightening, please do not relent. Take care

1 Like