AD JB Toolbox 01 EN

HTML Tutorial / Set the Page Title, Description, Language, and Encoding

An HTML document's head holds information such as its browser-tab title, character encoding, and page description. The document's default language belongs on html lang. These settings help browsers and other tools interpret and describe the page, but they do not replace readable content in body.

Start with a complete document

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Small Garden | Plant Care Guide</title>
  <meta name="description"
        content="Learn about beginner-friendly plants and basic care in the Small Garden guide.">
</head>
<body>
  <h1>Small Garden</h1>
  <p>Start learning how to care for plants.</p>
</body>
</html>

Save the code as index.html and open it in a browser. The title appears on the browser tab, while the h1 is visible on the page. They serve different purposes but should describe the same page consistently. The example's h1 is inside a sample document, not a second heading in this tutorial post.

Most head content is not shown as normal page text. Put instructions and explanations readers should see in body. On a multipage site, write a distinct, accurate title and description for each page rather than copying the same site name everywhere.

Set the language and character encoding

lang="en" says the document's default language is English. It can help assistive technology pronounce and process content. Use the actual page language; an occasional phrase in another language does not require changing the entire document's lang. A longer passage in a different language can have its own language attribute.

meta charset="utf-8" declares the character encoding. Save the file itself as UTF-8 too. If characters appear corrupted, check both the editor's save encoding and, when served online, the server's response headers. Changing the tag alone cannot repair a file saved in a different encoding.

Understand description and viewport

The description should summarize what readers will find on this specific page, not list keywords. Search engines may generate a result snippet from the page text or metadata, so the written description is not guaranteed to appear verbatim. See Google's search-snippet documentation.

The viewport setting affects the layout viewport and initial scale on mobile devices. It is useful with responsive CSS, but the tag alone does not make every element fit a phone. Do not restrict zoom merely because the text looks small; fix the CSS and type size instead. See the MDN meta reference and title reference.

Review the page before sharing it

Check that each tab title distinguishes its page, the visible heading describes the same subject, and characters display correctly. If you wrote a description, compare it with the current body rather than an older version. Open the page at a phone-sized width and test zoom and horizontal scrolling; metadata and layout need to work together.

More in This Category
HTML Tutorial / Form Validation with required, Length, and Range Limits

HTML Tutorial / Form Validation with required, Length, and Range Limits

Apply built-in required, length, and numeric constraints, test error states, and understand why server-side validation remains necessary.

HTML Tutorial / Responsive Images: srcset, sizes, and picture

HTML Tutorial / Responsive Images: srcset, sizes, and picture

Offer image resolutions with srcset and sizes, and switch crops with picture. Downloadable files let you test the examples in a browser.

HTML Tutorial / Embed Audio, Video, and External Content

HTML Tutorial / Embed Audio, Video, and External Content

Add audio and video controls, captions, and an iframe while checking file paths, formats, accessibility, and external embed policies.

HTML Tutorial / Build a Small Multipage Website

HTML Tutorial / Build a Small Multipage Website

Create linked Home, About, and Contact pages, test a practice form, and check navigation, keyboard use, and HTML validity.

HTML Tutorial / Form Structure and GET vs. POST

HTML Tutorial / Form Structure and GET vs. POST

Understand how form action, method, and control names determine where form values go, and when GET or POST is appropriate.

HTML Tutorial / Syntax

HTML Tutorial / Syntax

Learn the essential rules of HTML syntax, including elements, tags, attributes, void elements, comments, nesting, and the structure of a complete HTML document.

HTML Tutorial / Use textarea, select, option, and button

HTML Tutorial / Use textarea, select, option, and button

Create multi-line fields, selection lists, and form buttons while understanding initial values, submitted values, and reset behavior.

HTML Tutorial / Explain Forms with fieldset, legend, and autocomplete

HTML Tutorial / Explain Forms with fieldset, legend, and autocomplete

Group related controls with fieldset and legend, and use suitable autocomplete tokens to describe the purpose of input fields.

HTML Tutorial / Find Errors and Validate an HTML Document

HTML Tutorial / Find Errors and Validate an HTML Document

Use the Nu HTML Checker to find markup errors, repair a duplicate ID, and supplement validation with browser and keyboard checks.

HTML Tutorial / Links: Paths, Page Fragments, and Email

HTML Tutorial / Links: Paths, Page Fragments, and Email

Create HTML links with absolute or relative URLs, jump to a document fragment, and add email, new-tab, or download links. Learn what to verify before publishing.