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. It's an evolution of the markup you already write, not a revolution. We can use it to supercharge the markup that we already know how to write.
So, what did we actually do there? First of all, we...