CHAPTER 2

image

The Truth About a Basic HTML5 Web Page

Let’s start with the first line of a web page. It’s now just this:

<!doctype html>

That’s it. It’s short, it’s memorable, and it triggers standards mode in all major browsers (including IE6). It’s also case insensitive. In HTML5 the opening <html> tag has also been simplified to <html lang="en">.

Browsers will cope without the lang attribute, but it’s good practice to specify the page’s primary language, especially for non-English pages. (See this helpful article on declaring languages in HTML5: http://nimbupani.com/declaring-languages-in-html-5.html.)

Next comes the <head> tag, which will contain ...

Get The Truth About HTML5 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.