Question

A team member and I are having a disagreement on the usage of the <article> tag. By the definition in MDN, to me, it sounds like it should be used when presenting the user with content of some kind. He is saying we should be using it in a data entry page (no blocks of content are presented to the user). Pages like creating a new user, for instance. He wants to wrap all of the entry fields in an article element.

So, are either one of us right? Neither? Both? We are both new to writing semantic html, so we're trying to figure things out and we're stuck on this point of contention.

Was it helpful?

Solution

I think the spec is pretty clear:

The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication.

Or, in other words: the article element pretty much corresponds to the normal English dictionary definition of the term "article" in the context of publishing.

You don't have to distribute something independently to use article, but it should at least make sense to do so. Does it make sense to distribute the entry fields independently from the entry form? If yes, then article is appropriate, otherwise no.

The most fitting element in your case would probably be the fully generic and semantic-less div or maybe section. (But note that section, as generic as it is, already has some semantics associated with it, in particular, you should only use it if it makes sense for that section to appear as an item in an outline or table of contents. Therefore, a section should typically have a heading, i.e. a h1-h6 element possibly within an hgroup. Again, pretty much like the standard usage of "section" in publishing.)

The spec has a non-normative informational paragraph specifically about the difference between article and section.

Licensed under: CC-BY-SA with attribution
scroll top