Simple HTML5 Template

Author: MikeW    Date: 2016-08-06 23:30   

This simple HTML5 template was created as the first step in the process of creating this Markdown Cheat Sheet. The first step was to gather some resources. First I looked at Paul Irish's HTML5 Boilerplate:

HTML5 Boilerplate

This site has everything you would ever want to know about creating an HTML5 template. However, it seemed like a little too much information for me. So for the most part, I used Mark Pilgrim's HTML5 Up and Running to figure things out.

Or Mark's Dive Into HTML5 Site.

So walking through the book chapter by chapter, I came up with this:

   1 <!DOCTYPE html>
   2 <html lang="en">
   3 <head>
   4   <meta charset="utf-8"/>
   5   <title>Simple HTML5 Template</title>
   6 </head>
   7 <body>
   9 <h2>Header 2</h2>
  10 <p>This is a very simple HTML 5 template.</p>
  12 </body>
  13 </html>


Line 1 sets the DOCTYPE. Much, much simpler than previous versions of HTML. Notice the attribute on Line 2. Use the lang attribute to set the language in the html tag. A list of language codes published by IANA can be found here. Finally, line 4 you set the charset attribute in the meta tag. Just like for language, IANA keeps a list of valid character sets.

That is it. This is the simplest HTML5 template that seems to work all the time. For more information, please read Mark's book or go to the link provided above.