O'Reilly logo

Responsive Web Design with HTML5 and CSS3 by Ben Frain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to write HTML5 pages

Open an existing web page. There is a chance that the first few lines will look something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Delete the preceding code snippet and replace it with the following code snippet:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>

Save the document and you should now have your first HTML5 page as far as the W3C validator is concerned (http://validator.w3.org/).

Don't worry, that's not the end of the chapter! That crude exercise is merely meant to demonstrate HTML5's flexibility. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required