I was wondering why in the lessons they go through the effort to use the "nav"element to contain the navigation but then use “div” for all other body sections rather than using the other HTML5 semantic elements such as “header”,“section”,“article”,“footer”,etc.?
From the beginner perspective, mixing syntax with semantics up front can be confusing, and it can short-circuit priorities. What tags and attributes are can be a hill to climb for many, especially when we role it all into an element.
<p> => tag
</p> => tag
<p></p> => element
How often have we seen attributes referred to as tags?
If an intern writing a course module slipped in a semantic element, so what? It didn’t take any effort on their part and most learners gloss right over it while they struggle with links and href
and src
and #
, etc. Let the learners get used to DIV and the likes while they come to grips with, block vs inline; parent vs children, nesting and lists, tables and forms, and so on.
It was sufficient for HTML to grow on this path, which led up to the present Living Standard. I think it sufficient for the learner to acquire a solid understanding of structure, first, and let semantics creep in slowly as it becomes recognizable. The last thing we want a learner to do is treat this as a regimen. They need to keep all their creative channels open and see this as a way of meta-documenting content to signal special parsing semantics.
When we get to the stage of teaching the use of semantic elements the learner will be prepared to sit through the long lessons of how articles are structured and how each article should have its own H1, and so on, and so on, and …
The fact is, though, once the learner gets into some of the projects they will discover semantic elements in use. Some might even question it but most it seems just google it because the question only rarely comes up here.
Bottom line, there is no real why? other than human oversight or what I’ve spelled out above.
I was just about to post a similar question:
Undertand your logic but as a newbie should’t we being taught best practice in the current standard?
Yes the understanding the concepts of each topic is the most important outcome but would it not be better to start off using semantic HTML rather than the older way to encourage the creation of accessible code? At some point the switch has to flick and the use of semantic HTML needs to be second nature?
This isn’t a biggie and I’m loving the course content so in the general scheme of things I’m not struggling.
As a newbie, it is important to keep a clear slate. Design is a creative process and we wouldn’t want to stifle that in a learner. Rules and best practices will stifle creative thought by cramming in all kinds of expectations, most of them unreasonable. Structure and well-formedness is a high priority, followed by accessibility and then followed by semantics. Remember, HTML is already semantic in HTML 4. Every element takes its meaning from where we place it in the document outline. It is not what we use, but how we use it to mark up our content and add meaning. Forget 'semantic HTML` until it becomes meaningful to YOUR design, and not just some set of rules that we must follow.
Whether it is an article, a section or a div doesn’t make any difference. They are equivalent sectioning elements. It’s how we place them that brings meaning to the content, over and above its literal context, and that depends on structure, not tag selection.
<div>
<p>lorem ipsum</p>
<img src="#" alt="alternate description">
<p>image description</p>
</div>
is just as valid as using the modern <figure><img><figcaption>
markup. We didn’t throw out the old in favor of the new. HTML5 is still HTML 4 at its core, and HTML 4 is valid HTML5 (obsolete elements/attributes aside). As stated earlier, learn HTML from the ground up, working without styles, even, to get a complete picture of what raw markup looks like and how it behaves given the barebones default style sheet of the browser. If you skip this stage of learning, you miss all the good stuff that can prove useful to know as you progress.
This is not like learning to play the piano where one’s teacher practically beats bad habits out of our muscle memory. Likewise this is not rocket science. It is information science where order and organization enhance the meaning of contextual and visual data. It is also a science that depends heavily upon creativity. Best keep those in balance and toss the rule book for now.
Learn how to write valid markup and how to use a validator to discover and address any issues. Along the way you will undoubtedly be slipping in some newer tags but for your own reasons, not because of best practice
that someone else prescribes.