Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Changing the media type of the HTML does require a bit more strict syntax, but it also is a cheap trick to ensure the HTML tags and structure are arranged in a valid way.


This seems a bit bananas to me because there’s plenty of valid HTML5 is NOT valid XHTML or XML. For example, HTML5 allows common tags such as <p> and <li> to be unclosed, which is not valid in XHTML. HTML5 written in this style is not “wrong” - it’s valid, and correctly presented by tools like VoiceOver. Screen readers will be a-okay with HTML5; this advice is going to send people down wild goose chases with no need.

XHTML is an alternative, dead-end branch of HTML evolution that time has forgotten.

To validate HTML, use an HTML validator.


> HTML5 allows common tags such as <p> and <li> to be unclosed

Yet many people (me included) consider this inappropriate and never use this allowance.

In some cases (when you hand-type/edit huge HTML documents) it is a handy feature but there probably are many scripts that can close the tags for you once you're done.


In modern browsers all modern HTML5 is valid XHTML so long as it conforms to the syntax and tag structure. In fact the only real difference, aside from closing tags like br and img, is that with XHTML the browser yells at you when you get HTML wrong.

On my personal sites I send all my HTML with a .xhtml file extension to force XML compliance, but the code is modern HTML5.


that is wrong. this is valid html5 for example:

  <ul>
    <li>content
    <li>content2
  </ul>
quick google got me this blog post: https://blog.teamtreehouse.com/to-close-or-not-to-close-tags...


I am aware.




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

Search: