Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
That's certainly true, and in many cases you don't need it. You can definitely just put the <h1> (or <h2>, ...) tag on its own, and AFAIK that works just as well for screen readers, SEO, etc. But the advantage of a <header> is being able to group other things like inline icons, section anchor πlinks, etc., and I find myself going back and adding those later often enough that I have just made a habit of using a <header> wrapper almost all the time. But with that said, it's a very YMMV situation, so feel free to skip the <header> if you feel confident you don't need more than the <h1>, there's nothing wrong with that semantically π
If you think of a magazine or newspaper article it makes more sense. Things like a byline, publication date, subtitle, those are all still part of the header for that article. You would want to group them semantically.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Isn't it kind of redundant to use a 'header' tag just wrap an 'h1' tag? Seems to me to clutter up the dom structure...
That's certainly true, and in many cases you don't need it. You can definitely just put the
<h1>
(or<h2>
, ...) tag on its own, and AFAIK that works just as well for screen readers, SEO, etc. But the advantage of a<header>
is being able to group other things like inline icons, section anchor πlinks, etc., and I find myself going back and adding those later often enough that I have just made a habit of using a<header>
wrapper almost all the time. But with that said, it's a very YMMV situation, so feel free to skip the<header>
if you feel confident you don't need more than the<h1>
, there's nothing wrong with that semantically πIf you think of a magazine or newspaper article it makes more sense. Things like a byline, publication date, subtitle, those are all still part of the header for that article. You would want to group them semantically.