HTML and CSS Reference
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:
The <body> tag is capable of accepting numerous attributes, including the ID attribute, like this:
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 ,
loaded by the browser.
To learn more about how CSS is used with the <body> tag, see Lesson 4.
In this Try It you learn how to create a basic HTML page.
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.
Open your favorite text editor.
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.