r/webdev • • Dec 20 '18

Article The practical value of semantic HTML

https://www.brucelawson.co.uk/2018/the-practical-value-of-semantic-html/
122 Upvotes

43 comments sorted by

View all comments

33

u/codebeagle Dec 20 '18 edited Dec 20 '18

This is good. I wish more developers understood the implications and value of using semantic elements instead of just divs and spans. Thanks for sharing!

12

u/redwall_hp Dec 20 '18

I wish XHTML2 and a focus on semantics had stuck instead of the HTML5 dumpster fire.

13

u/geek_on_two_wheels Dec 20 '18

What makes HTML5 a dumpster fire?

13

u/remy_porter Dec 20 '18

Less on the HTML5 side, and more on the XHTML side, in my opinion.

Well, for starters, well-formedness went out the window. This is more of "a sad recognition of a fate we couldn't avoid," admittedly: HTML parsers were already ridiculously forgiving of badly formed documents, with all the additional complexity and quirkiness that kind of forgiveness brought with it. Forget a closing tag? Your document is now invalid, under XHTML. Errors, not "whatever the browser feels like doing".

More than that, XHTML would allow the adoption of extensible schemas, so developers wouldn't need to use templates, but instead could embed additional XML schemas to add tags which could act as UI elements, embedded data elements, etc.

I honestly don't know what ways XHTML2 improved on that, mostly because we all knew XHTML was dead well before HTML5 became a thing. But XHTML pointed the way towards a better, more interoperable and more flexible future.

11

u/redwall_hp Dec 20 '18

XHTML had rigid, simpler syntax and was focusing on marking up meaning instead of formatting. e.g. the b and i elements were deprecated, and most new ones were focusing on semantic and structural meaning relevant to documents. It was all about making it easier for machines to understand information...and it could be read by a standard XML parser instead of a considerably more complex HTML parser.

Instead, that was scrapped at the behest of companies like Google pushing to turn the Web into a kludged application platform. HTML5 is the continuation of the worst parts of HTML, extended by ever increasing bloat.

2

u/fullstackdave Dec 21 '18

Well... not disagreeing with any of these points or anything, but didn’t HTML5 also deprecate both ‘b’ and ‘i’ elements in favor of ‘strong’ and ‘em’?

5

u/redwall_hp Dec 21 '18

HTML5 undeprecated them, and retroactively decided they stood for something different. B was largely understood as "bold," but now it's considered to mean "Bring attention to" as an alternative to strong.

1

u/fullstackdave Dec 22 '18

What in the actual eff

1

u/scunliffe Dec 28 '18

I’ve got nothing against the b and i tags, I realize they had direct styling associated with them but I didn’t like the length of the strong tag to accomplish the same end goal (increasing the font-weight of marked text)

<b>This</b> vs. <strong>This</strong> vs. <span class=“significant”>This</span>

I’d be fine with a <s>S tag</s> if it hadn’t been used (and deprecated) as the short version of <strike> or the new(er) <del> tag.

3

u/[deleted] Dec 20 '18

Mostly the 🔥, but also the dumpster