HTML and CSS Reference
In-Depth Information
enclosing the content with <body>
The second structural branch within the <html> tag is the <body> tag. The body section is home to all
the content visible in the browser. As the containing element for such content, the <body> tag plays a
pivotal role in styling as well as interactively presenting the page.
The <body>… </body> tag pair is written immediately after the closing </head> tag and before the
closing </html> tag, like this:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
The <body> tag is capable of accepting numerous attributes, including the ID attribute, like this:
<body id=”home”>
A page with a distinctive ID in the <body> tag can be targeted for specific styling using CSS. Other
common attributes include lang , for defining the primary language used in the page, and onload ,
which can be used for triggering one or more JavaScript functions when the page has been fully
loaded by the browser.
To learn more about how CSS is used with the <body> tag, see Lesson 4.
Try iT
In this Try It you learn how to create a basic HTML page.
Lesson requirements
You will need a text editor (such as NotePad on the PC, or TextEdit on the Mac) and a web
browser, such as Internet Explorer, Firefox, or Safari.
step-by-step
1.
Open your favorite text editor.
2.
If you're using TextEdit on the Mac or any other RTF editor, switch to plain text. In
TextEdit, for example, choose Format Make Plain Text.
Search WWH ::




Custom Search