So it looks like we’ll be getting a
main element in HTML5 after all. Good news. But Jeremy Keith poses a follow-up question I’d been wondering myself: Why can’t we use it in every section, just like
footer, instead of only once on the
body element? (Check out Jeremy’s post for the necessary technical background.)
We saw this same kind of thing during the last go-around with
footer. To a lot of us markup jockeys it feels off. For us the fundamental nature of HTML5’s foundation-level markup improvements have been all about sectioning content. To have something dangled in front of us that seems so darn, well, section friendly, and then be told we can’t use it in those those places is odd. Especially when its closest siblings don’t behave the same way (those would be
header and the now-revised
Now me, I’m selfish. I want to see
main made available for use inside elements like
article because I want to explicitly define the core content of those elements and provide an easy hook for styling in one semantic shot. It’s a markup pattern I run into a lot. One I’d wager plenty of other folks do too.
I know there are all sorts of solid reasons the standard might not go this way, based on a pile of data about markup usage in the wild. But the potential uses that come from making
main more flexible strike me as both beneficial to developers and not much of a stretch from the current proposal. It might not be a cowpath yet, but plenty of us would sure like to tread down it.
It’s been pointed out to me that this incarnation of the
main element was focused right from the very start on accessibility, which brings with it a very different set of concerns that override what I’ve noted above. And at the end of the day, it’s what won out. Bruce Lawson has a good write-up. After a few quick tweaks to reset stylesheets, shivs, and the like, I’ve already started using it in my projects. (Though I do still kinda-sorta wish there was a more explicit, semantic way to identify the main content of sectioned items other than just treating it as, “stuff in a section that isn’t inside a