22.06.2015 Views

Step by Step HTML5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Creating the HTML, Head, and Body Sections 15<br />

Creating the HTML, Head, and Body Sections<br />

All of your HTML coding—except the DOCTYPE tag—should be placed within the twosided<br />

tag. Recall from the Introduction that when a tag is two-sided, it requires<br />

a corresponding closing tag that is identical to the opening tag but contains a slash:<br />

. The tags and serve as a “wrapper” around all the other tags in<br />

the document.<br />

In addition, your document should have two sections: a Head and a Body. The Head section<br />

is defined <strong>by</strong> the two-sided tag . The Head section contains the page title,<br />

which is the text that will appear in the title bar of the Web browser and on the Microsoft<br />

Windows taskbar button. It also includes information about the document that is not displayed,<br />

such as its tags (which you’ll learn about on page 19). You can also include<br />

lines of code that run scripts, like Javascript.<br />

The Body section is defined <strong>by</strong> the two-sided tag , and it contains all the information<br />

that appears in the Web browser when you view the page.<br />

Note The , , and tags are all optional in HTML—but you should still use<br />

them because it’s a good design practice. They are required in XHTML. In addition, in XHTML<br />

you must add an argument to the tag that declares its XML namespace, a reference to<br />

the fact that XHTML is created within XML (as you learned in Chapter 1, “Editing and Viewing<br />

HTML Files”). Here’s how the opening tag should look in an XHTML document: .<br />

In this exercise, you will create an <strong>HTML5</strong> template file that you can reuse later for your<br />

own work.<br />

SET UP Start Microsoft Notepad before beginning this exercise.<br />

1. In Notepad, open the Format menu. Word Wrap should have a check mark next<br />

to it. If it does not, click it to enable the Word Wrap feature.<br />

Tip Using Word Wrap makes it easier to see long lines of HTML coding without scrolling.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!