Hacker News new | past | comments | ask | show | jobs | submit login

With CSS, the concept of differentiated HTML tags basically became obsolete. The purpose of HTML now is just to break apart and identify the content fields in an XML format. The only tags I really use in the HTML body are div and a - and I only use a because I can't add a href attribute into a div. Some people have tried to argue against this way of doing things ("divitus") but as far as I can tell their criticisms are pedantic, not practical. If some one has a good practical argument for specialized HTML tag names, I'd love to hear it.



The argument against this approach is that it's not always humans accessing web pages. And even if it is humans, sometimes they need computer assistance to interpret the content. http://en.wikipedia.org/wiki/Semantic_HTML


As the article says, this is equivalently achieved by naming div classes and IDs (or some other attribute like itemprop a la schema.org). Also I'd say a completely style-free HTML scheme with open-ended semantic tag names (XML) styled by CSS is equivalent. The point is HTML doesn't serve a useful styling purpose.


I don't have a strong opinion on whether browsers should provide default styling, as it's trivial to override (although many web pages do rely on it). I agree that HTML tag names don't serve a very useful styling purpose, but they provide a useful structural purpose that cannot be easily replaced by using open-ended tag names or classnames. Custom Elements (http://w3c.github.io/webcomponents/spec/custom/) are in the process of being implemented, but I don't think that's an argument for throwing out the standard, structural elements that provide a common API for interpreting document structure.


I guess you've never tried to navigate and understand a web page made only with div and a elements in a screenreader.


I'd be all for a free, semantic naming scheme - which we basically already have with the exception you mentioned; it's discouraged, but you could absolutely make documents that way today.

I think overall it's a good thing to have certain tags that are associated with default behavior. We could weed out some unneeded ones aggressively, but overall I think it's okay to be able to write a basic CSS-less HTML page that is not a formless mass by default. This mechanism also has traditionally benefited accessibility agents.

So, it basically comes down to the question of whether it's time to remove the default rendering properties of tags. What we're left with then is decisions about the special attributes, as you mentioned. Some of these we could get rid of, too, and some could be made more general. We have painted ourselves a bit into a corner with the href attribute specifically. If we didn't sometimes have to use it for completely different things, it would be totally fine to declare every tag having an href attribute to have link-like behavior.


> If some one has a good practical argument for specialized HTML tag names, I'd love to hear it

It can matter in ways for SEO. Having an <h1> helps the robots figure out what your page is called; using <link>s can help explain the organization of your pages; having a <nav> can help influence what your sitelinks[1] will be (if you're enough of a baller to be getting them).

[1] https://support.google.com/webmasters/answer/47334?hl=en




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: