<!DOCTYPE html><html lang=en><head><meta charset=utf-8> <title>Title</title> <meta name=viewport content="width=device-width,initial-scale=1"> <meta name=description content="search engine description text"> <link rel=icon type="image/png" href="/favicon.png"/> </head><body> <div>Page contents</div> </body></html>
This isn't strictly the smallest standards-compliant HTML page; that would be <!DOCTYPE html><title>t</title><p>p
. Even smaller pages will be displayed by browsers just fine.
However, this has some features that are very nice on the modern web. The meta name=viewport
line makes the page readable without zooming in on mobile browsers. The meta charset
line is pretty much obligatory unless you code in pure ASCII. The link rel=icon
line can probably be omitted if you're fine with the website root's /favicon.ico
. The meta name=description
line lets you set the text that's shown in search engine results and the blurb for when your link is pasted to some social media sites and chat apps, like Discord. The lang
tag on the <html>
element isn't mandatory, but helpful for various reasons; use lang=zxx
for text that is not in any language.