What is SEO in HTML?

SEO (Search Engine Optimization) in HTML means writing markup that search engines can crawl, understand and present well: a unique <title> and meta description, semantic structure with one clear <h1>, descriptive links and alt text, canonical URLs, structured data, and fast, mobile-friendly pages.

On-page essentials

  • <title> and <meta name="description">: unique per page; they form your search snippet.
  • Headings: one <h1> describing the page, then a logical <h2>/<h3> outline.
  • Semantic elements: <main>, <article>, <nav> help crawlers find the core content.
  • Links: real <a href> with descriptive text ("pricing plans", not "click here"); crawlers do not follow onclick handlers.
  • Images: meaningful alt, explicit width/height, modern formats.
  • <html lang> and hreflang alternates for multilingual sites.

Technical tags

  • <link rel="canonical"> resolves duplicate URLs.
  • <meta name="robots" content="noindex"> keeps pages out of results.
  • Open Graph / Twitter tags control social previews (not ranking, but click-through).
  • JSON-LD structured data (<script type="application/ld+json">) enables rich results: breadcrumbs, articles, products, FAQs.

Beyond markup

Server-rendered or statically generated HTML (rather than content rendered only on the client), Core Web Vitals (LCP, INP, CLS), sitemap.xml, robots.txt and HTTPS all influence how well pages are indexed.

Interview tip

Explain that search engines reward helpful content first; HTML makes that content discoverable.

Code example

html
1<!doctype html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>Trail Running Shoes for Women | Acme Outdoors</title>
7 <meta name="description" content="Lightweight, waterproof trail running shoes for women. Free returns and 2-day shipping.">
8 <link rel="canonical" href="https://acme.example/shoes/trail-women">
9 <meta property="og:title" content="Women's Trail Running Shoes">
10 <meta property="og:image" content="https://acme.example/og/trail-women.jpg">
11 <script type="application/ld+json">
12 {
13 "@context": "https://schema.org",
14 "@type": "Product",
15 "name": "Acme Trail Runner",
16 "offers": { "@type": "Offer", "price": "129.00", "priceCurrency": "USD" }
17 }
18 </script>
19</head>
20<body>
21 <main>
22 <h1>Women's trail running shoes</h1>
23 <img src="https://picsum.photos/300/150" alt="Blue Acme Trail Runner shoe on a rocky path" width="300" height="150">
24 <p>Compare our <a href="/shoes/trail-women/sizes">size guide</a> before ordering.</p>
25 </main>
26</body>
27</html>

Practice this question

Open it in the study app to track progress, take notes, listen to the answer and work through the rest of the HTML & CSS set.

Open in study app