A thought on presentational versus semantic HTML

August 29, 2022

One of the long running argument topics in web design is semantic versus presentational HTML, which is to say a split between writing HTML (and CSS) purely for how the result looks and authoring HTML that tries to put its semantic meaning first and then style the semantic meaning with CSS. There is a wide spectrum between these two poles, of course, especially once you start caring about issues like (HTML) accessibility. Recently, I had a thought about why this issue persists and why we don't all write semantic HTML and be done with it, especially since semantic HTML is often easier and simpler.

One of the realities of life is that as people, we care about how things look, partly because in practice you can't divorce content from presentation. This means that most people are always going to care about how their HTML looks. If you write semantic HTML, making your HTML look right is a two step process; first you write carefully taxonomized ('semantic') HTML, and then you get it to look right with CSS or whatever. If you write presentational HTML, you have only one step; you write your HTML (and CSS) and directly tweak things if necessary.

People don't always have the capability, the interest, or the time to take these two steps instead of one (this is especially the case for making it look right everywhere). Brute force works pretty broadly; complex processes to turn semantic markup into what looks good (or what you want) is not necessarily so much. If you don't actually need semantic HTML for some other reason, such as content reuse (or you need only a little bit of it), writing presentational HTML is the easier way; it can often get you better looking pages easier.

(An even easier way is to write HTML within the confines of something that provides the style you want, or that looks good to you. Or to not write HTML, for example by writing Markdown and then letting something translate it for you. But people don't always have such a thing readily available.)

I also think that one of the reasons that presentational HTML works so well is that browsers have been implicitly punished for rendering such HTML in a divergent way, or at least in a divergent way that makes it look worse. If you try some new browser and it makes web pages look bad to you, you're probably not really going to stick with it; you're going to go back to your previous one (a similar force acts to keep successive browser versions from changing their rendering). People grouse about bug for bug compatibility, but I think there's a real argument that it's generally the right choice.

(The short version is that there's a huge amount of value in all of the existing HTML out in the world, and degrading that value is a bad thing.)

Written on 29 August 2022.
« Getting USB TEMPer2 temperature sensor readings into Prometheus (on Linux)
ZFS DVA offsets are in bytes, not (512-byte) blocks »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Aug 29 22:40:06 2022
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.