Minimum HTML document
A small HTML document needs a doctype, a root element, metadata, and visible body content.
What you will learn
- Which elements belong in the document skeleton
- How to open the result in a browser
Minimal example
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>My page</title> </head> <body> <h1>Hello</h1> </body> </html>Save the code as index.html and open it in a browser. The heading appears because it is inside body.
Common mistakes
- Put visible content in
body, nothead. - Use a valid doctype and set the document language.