Skip to content

HTML5 Hello World

<!DOCTYPE html>
<title>Hello World</title>
<p>Hello world!</p>

This is valid HTML5. Mind blowing if you are the type who was writing XHTML Strict just a few short years ago (like me). Here’s the same in XHTML 1.0.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>Hello World</title></head>
<body>
<p>Hello world!</p>
</body>
</html>

There is a big improvement going to HTML5. The short doctype is even backwards compatible but you might want to use <head> and <body> to keep browsers happy.

2 Comments

  1. zcorpan wrote:

    You forgot the namespace declaration in the XHTML version! :-)

    Tuesday, November 3, 2009 at 1:31 am | Permalink
  2. chizu wrote:

    Thanks, nice catch. +1 gotcha.

    Tuesday, November 3, 2009 at 11:31 am | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*
Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 655 bad guys.