HTML Optional Tags

The cluster discusses the validity of omitting closing tags and wrapper elements like <html>, <head>, and <body> in HTML, browser parsing behavior, and compliance with HTML specifications.

➡️ Stable 0.6x Web Development
5,399
Comments
20
Years Active
5
Top Authors
#2752
Topic ID

Activity Over Time

2007
18
2008
26
2009
200
2010
264
2011
268
2012
331
2013
327
2014
263
2015
234
2016
260
2017
247
2018
160
2019
322
2020
313
2021
354
2022
436
2023
436
2024
440
2025
370
2026
130

Keywords

berkshirehathaway.com BTW whatwg.org EM JSON html.spec syntax.html CDATA HTML5 W3C html tags closing tag spec elements element browsers pre span

Sample Comments

luchs Sep 17, 2016 View on HN

Not really liberal - leaving out those tags is perfectly fine according to the specification and all compliant browsers will create the same DOM from it.

marginalia_nu Dec 30, 2023 View on HN

HTML has this, yet browsers seem to cope...?

lelandfe Jan 12, 2025 View on HN

`` in the source :)

em-bee Nov 10, 2024 View on HN

HTML allows to omit closing tags for , and others

johnrob Dec 20, 2007 View on HN

"No closing tag": nice, I wonder how (non-X) html became so unruly ;)

piracyde25 Jun 9, 2018 View on HN

This and generally other HTML tag codes aren't supported atm. Otherwise, it looks clean I like it :)

ufo Mar 11, 2015 View on HN

This is good for hand-written html but annoying for machine-written html.

Izmaki Jan 9, 2021 View on HN

What about the standard ...... tags?

twodayslate Oct 4, 2013 View on HN

That's the weirdest way to format HTML I've ever seen

tzs Aug 18, 2023 View on HN

What if the document has omitted the tag?