{"id":363745,"date":"2022-03-21T13:08:38","date_gmt":"2022-03-21T20:08:38","guid":{"rendered":"https:\/\/css-tricks.com\/?p=363745"},"modified":"2022-03-21T13:08:40","modified_gmt":"2022-03-21T20:08:40","slug":"write-html-the-html-way-not-the-xhtml-way","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/write-html-the-html-way-not-the-xhtml-way\/","title":{"rendered":"Write HTML, the HTML Way (Not the XHTML Way)"},"content":{"rendered":"\n

You may not use XHTML (anymore), but when you write HTML, you may be more influenced by XHTML than you think. You are very likely writing HTML, the XHTML way.<\/p>\n\n\n\n

What is the XHTML way of writing HTML, and what is the HTML way of writing HTML? Let\u2019s have a look.<\/p>\n\n\n\n\n\n\n

HTML, XHTML, HTML<\/h3>\n\n\n

In the 1990s, there was HTML. In the 2000s, there was XHTML. Then, in the 2010s, we switched back to HTML. That\u2019s the simple story.<\/p>\n\n\n\n

You can tell by the rough dates of the specifications, too: HTML \u201c1\u201d 1992, HTML 2.0 1995, HTML 3.2 1997, HTML 4.01 1999; XHTML 1.0 2000, XHTML 1.1 2001; \u201cHTML5\u201d 2007<\/a>.<\/p>\n\n\n\n

XHTML became popular when everyone believed XML and XML derivatives were the future. \u201cXML all the things.\u201d For HTML, this had a profound effect: The effect that we learned to write it the XHTML way.<\/p>\n\n\n

The XHTML way of writing HTML<\/h3>\n\n\n

The XHTML way is well-documented, because XHTML 1.0 describes in great detail in its section on \u201cDifferences with HTML 4\u201d<\/a>:<\/p>\n\n\n\n