iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

HTML Basic

Every HTML page follows the same skeleton: a doctype declaration, a root <html> element, and two children — <head> for metadata and <body> for visible content.

The document skeleton

<!DOCTYPE html> <html> <head> title, meta, links to CSS </head> <body> everything visible on the page </body>
Fig 1. Every HTML page nests a head and body inside an html element.

What goes where

SectionPurposeTypical contents
<!DOCTYPE html>Tell the browser to use HTML5 standards mode.
<head>Information about the page, not shown in it.<title>, <meta>, <link>, <script>
<body>The actual content the user sees.Headings, paragraphs, images, links, forms…
Note: The <!DOCTYPE> declaration is not a tag — it's a one-line instruction. Without it, browsers fall back to "quirks mode" and lay out the page differently.

Example

Example
<!DOCTYPE html>
<html>
<head>
    <title>HTML Basic</title>
</head>
<body>

<h1>HTML Basic</h1>
<p>This is a demo page for the "HTML Basic" lesson.</p>

</body>
</html>
Try it Yourself »

Exercise

Complete the page skeleton with the doctype and the root html element.

< > <head><title>Hi</title></head> <body>Hello</body> </html>

Test yourself

Q1. Which declaration tells the browser to use HTML5 standards?
Q2. What lives inside <head>?
Q3. Where does the visible page content go?

Discussion

Loading…