Bhylu

HTML Basic

A complete HTML document has a small, predictable structure. Keeping that structure clear makes later additions such as stylesheets, images, and forms easier to place correctly.

How it works

  • Put <!doctype html> before the root element so the browser uses standards mode. It is a declaration, not an element with an end tag.
  • The html element contains head for metadata and body for page content. Set lang on html to identify the document’s language.
  • Use UTF-8 and a useful title from the beginning. A viewport declaration helps mobile browsers size the page appropriately.

A practical example

HTML

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Seed library opening times</title>
</head>
<body>
  <h1>Visit the seed library</h1>
  <p>Open on Saturday mornings.</p>
</body>
</html>

Metadata stays out of the visible reading area. The body contains a single main heading and a short paragraph, ready for additional semantic structure.