What does the viewport meta tag do?
<meta name="viewport" content="width=device-width, initial-scale=1">tells mobile browsers to lay the page out at the screen's width. Without it, phones use a desktop width (often 980px) and zoom out, so text is tiny and media queries misfire.Do not add
maximum-scale=1oruser-scalable=no: blocking pinch zoom stops low vision users from enlarging text, which WCAG resize text asks to work up to 200%. See the viewport page.Do the meta description and meta keywords tags affect ranking?
Not directly. Google ignores
<meta name="keywords">, and the description is not a ranking factor, but it is often shown as the snippet under your title, so a good one earns clicks.<title>Learn HTML Forms with Examples</title> <meta name="description" content="Build forms with labels, input types and validation. Every example runs in the browser.">Write a unique description for each page; Google may shorten or rewrite it. The
<title>does affect ranking.Why do you need
<meta charset="utf-8">, and where does it go?It tells the browser how to decode the page's bytes into characters; with the wrong encoding
Caféshows up asCafé. The spec requires it within the first 1024 bytes, so put it first in<head>. AContent-TypeHTTP header with a charset takes priority over it, so the two should agree.What is a canonical link, and when do you need one?
<link rel="canonical" href="...">names the preferred URL when the same content is reachable at several URLs, so ranking signals are combined on one page.<link rel="canonical" href="https://example.com/shoes/running">Duplicates usually come from tracking and filter parameters. Use an absolute URL. Google treats it as a hint and can pick another canonical if the signals disagree.
What is the difference between the robots meta tag and robots.txt?
robots.txtcontrols crawling (which URLs a crawler may fetch); the robots meta tag controls indexing of a page that was fetched.<meta name="robots" content="noindex, follow">The trap: a page blocked in
robots.txtis never fetched, so itsnoindexis never seen, and the URL can still be indexed from links. To keep a page out, allow crawling and usenoindex.What is
hreflang, and how do you use it for a multilingual site?hreflanglinks tell search engines which URL serves which language or region, so searchers get their own language.<link rel="alternate" hreflang="en" href="https://example.com/pricing"> <link rel="alternate" hreflang="hi" href="https://example.com/hi/pricing"> <link rel="alternate" hreflang="de" href="https://example.com/de/pricing"> <link rel="alternate" hreflang="x-default" href="https://example.com/pricing">Every version lists all versions including itself, links must be reciprocal, and
x-defaultis the fallback. Each version keeps its own self-referencing canonical; pointing them all at the English page drops the translations.What is structured data, and how do you add it to a page?
Structured data describes the page's content in the schema.org vocabulary, so search engines know it is a product, an article or a recipe. Google recommends JSON-LD in a script tag.
<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "headline": "HTML Interview Questions", "datePublished": "2026-03-14", "author": { "@type": "Organization", "name": "Coddy" } } </script>It can make a page eligible for rich results but is not a ranking boost, and it must match the visible content.
What is the difference between
rel="nofollow",rel="ugc"andrel="sponsored"?All three tell search engines that a link is not your editorial endorsement.
sponsoredmarks paid links, ads and affiliate links;ugcmarks links in user-generated content such as comments and forum posts;nofollowcovers any other link you do not vouch for. They can be combined:rel="ugc nofollow". Google has treated them as hints rather than rules since 2019, and paid links withoutsponsoredornofollowcan bring a manual action.
HTML SEO and Meta Tags Interview Questions
Title, description, viewport, charset, canonical, Open Graph, robots, hreflang and structured data.