HTML and CSS Reference
In-Depth Information
Listing 2-5. HTML Source Code for Hello World!
<!DOCTYPE html>
<html lang="en-GB" dir="ltr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0;
maximum-scale=1.0; user-scalable=0; target-densitydpi=device-dpi;"/>
<title>My First Mobile Web App</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
If you are not familiar with some of the HTML elements shown in Listing 2-5, the
first line is the new HTML5 doctype. In HTML5, you do not need to specify a
DTD, which can usually be found in XHTML 1.1 pages. Listing 2-6 shows the
difference between an XHTML 1.1 doctype declaration and an HTML5 doctype
declaration.
Listing 2-6. The Difference Between an XHTML 1.1 Doctype Declaration and an HTML5 Doctype
Declaration
<!-- HTML4 Doctype Decleration -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
" http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!-- HTML5 Doctype Decleration -->
<!DOCTYPE html>
As you can see, there is now no need to Google or memorize the location of the
DTD path or specify the HTML version.
In the HTML tag, I have added two attributes: <html lang="en-GB" dir="ltr">.
lang will specify the language used within the document, and dir dictates the
reading direction. dir has been set to ltr for left to right, and lang has been set
to en-GB for English - Great Britian.
Proceeding to the head element, there are two meta tags, as shown in
Listing 2-7.
 
Search WWH ::




Custom Search