<main> HTML tag is paradoxically absent from most of the web. I
haven't done a research, but what I usually find, in the place of main,
it's just a wrapper div, sometimes even curiously framed as
<div class="main">. It could hardly be more ironic. Tags such as
<section> are also hard to find, even
though when they make perfect, obvious sense, much more preferable to the generic
div. I suppose there must be some reason behind it, perhaps just habit, or
not being able or allowed to touch a website generator; but I will stop my guessing
right now. Let me, instead, focus on why we should use them.
- It's generally good practice
- It makes life easier for applications and its users: think on screen readers, or web crawlers
- It makes your code easier to maintain
Let me dwell in the later point, even if you are working on your one, on your pet project,
one that you revise almost every day so you know it to the last comma, do you really need a
mesh of nested divs on divs, all injected with classes? You know what?
can have id and class too, so you can make that framework,
or any other piece of code happy, with the added benefit of saying what you mean. That is
what I love about Python, that its structure is, almost without exception, clear and to the point.
And that is something I always want in my code.