Creating a Site Framework in HTML5

In a valid HTML5 page, the only required tags are the doctype (more on doctype in a moment), title, and a block element, such as the paragraph tag with a little content.

Many of the tags in an HTML5 page will be familiar to you if you’ve worked with previous versions of HTML. You still surround the entire contents of the page with opening and closing <html> tags, the <head> tags contain the <title> tags, and the contents of the page that will display in a web browser are contained within the <body> tags.

Here’s the essential structure of a simple HTML5 page. We review the new HTML5 tags, line by line, in the sections that follow.

<!DOCTYPE html>

<html lang=”en”>

   <head>

      <meta charset=”UTF-8”>

      <title>This is a simple page title</title>

   </head>

   <body>

      <p>The content for a simple page goes here.</p>

   </body>

</html>

tip_4c.eps We don’t think you should ever have to type any of our code samples, so we include all the code you see in this chapter on the website that goes with this book. Just visit www.digitalfamily.com/mobile to find all the code in the book, as well as instructions for how to copy and paste the code from our site into your own web pages.

Starting with the doctype

The doctype, which tells a browser how to interpret the HTML code in a web page, is one of the most significant changes in HTML5. In HTML4, web authors ...

Get iPhone® & iPad® Web Design For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.