Why are we taught semantic HTML and then all exercises in CA ignore it?

I’m currently working through the web development course and have finish HTML, CSS and i’m currently working through the JS material.

After being taught semantic HTML where it talks about using section and article instead of using divs, every single exercise and piece of material, whether it be HTML, CSS or JS has all just been a full page of divs to separate everything and to name class’

In a real world scenario, how many websites realistically are practising using section and article etc? Even when I have used chrome dev tools to inspect e.g. Amazon, Google etc, they all seem to just be a big div fest?

Thanks

In a real world scenario, it would be best to use semantic HTML whenever it makes sense.

Another thing to take into account is the amount of legacy code that’s still present today. It might not make sense for Amazon, for example, to revamp their HTML code. They probably don’t care, simply because their pages will work regardless of what they use. Semantic HTML will simply enhance the meaning of the markup. It won’t change it dramatically, nor how it appears to the end user.

It can have an influence on screen readers, though. As well as that, semantic HTML is easier for robots (crawlers) to parse and understand the structure and meaning of the markup. So it somewhat helps SEO efforts (it may not be a major factor, but I suspect it does help a bit).

And I think I read somewhere that some frameworks mainly use divs to create elements on a page, but I might be wrong. Someone with experience of front-end frameworks such as React, Angular and Vue should confirm this.

So, for any new project that you’d start today, I’d strongly advise to make use of semantic HTML. Newer web apps use it. If you inspect the code of this forum, for example, you’ll notice that they use a mix of div, section, article, etc. It makes sense for web apps in 2020.

3 Likes

To add a little to @ghostlovescore’s excellent answer, please keep in mind that the Web Development Career Path draws from several other courses which can be taken in their own right.

The use of generic <div> tags in the CSS course, for example, may be intentional - keeping the markup as vanilla as possible, so the focus is on learning about CSS rulesets without a potential distraction of “Oh, what’s a <footer> tag? I’ve never seen that before”…

(There’s also the possibility that some learners taking the CSS course might know HTML from a while back, like me. Having originally taught myself HTML waaaaaaaaaaay back in the late 90’s, when many a site used a <frameset> to do interesting layouts, some of the changes in HTML5 were very new when I revisited this a few years ago.)

2 Likes

Oh my… this and tables for structure :sob: them good old days (or not)

Amusingly, another favourite of the 90’s casual web developer still works… that delightful tag which made things scroll across the screen… <m......> :rofl:

You could be sure to find this around the header / nav region as if there was some major breaking news going on, on a lot of amateur videogame websites (which I loved), until the early '00s.

Well, this might’ve made me a tad nostalgic…

1 Like