Jens Oliver Meiert

The World’s Best HTML Template

Published on Apr 29, 2008 (updated Feb 5, 2024), filed under (feed). (Share this on Mastodon or Bluesky?)

This and many other posts are also available as a pretty, well-behaved ebook: On Web Development.

This post is partially outdated.

…to start with is this, until the rise of HTML 5:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="1">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>2</title>
  <link rel="stylesheet" href="3">
  <p>4

This applies as long as you want your pages to be distributable offline as well, which has been the only reason to include the html start tag, its lang attribute, and a meta element with encoding information. (Online, you can specify this information on the server side.)

The template is available for download; above, n designates placeholders and parts to be modified, though these are complemented by documentation I needed to add because of my blog software’s code formatting rules. Many things are implied, but don’t hesitate to call them out.

  1. Language code
  2. Title element
  3. Style sheet
  4. Content

Regarding this post’s title: I’ve never been shy, and this represents how I learn.

Update (May 4, 2008)

Since there seems to be some confusion about this post and why this template is supposed to be “best,” here’s the short explanation: For a general template to be “best,” it should work in as many scenarios as possible without requiring modifications, and its code should be minimal, valid, and maintainable. This template works everywhere.

Even when you don’t worry about problems with Conditional Comments, reset style sheets, or frameworks, it’s the simple approaches that lead to quality. In general, most templates and frameworks are too much, bringing their own maintainability and performance problems. The template above that is so disappointing for some avoids that—it can only do so because it’s minimal.

Update (May 26, 2008)

Now there’s also a similarly valid HTML 5 version of the template [gist]. When only used online on a properly configured server, omit both the html start tag and the encoding definition as well.

About Me

Jens Oliver Meiert, on November 9, 2024.

I’m Jens (long: Jens Oliver Meiert), and I’m a web developer, manager, and author. I’ve worked as a technical lead and engineering manager for small and large enterprises, I’m an occasional contributor to web standards (like HTML, CSS, WCAG), and I write and review books for O’Reilly and Frontend Dogma.

I love trying things, not only in web development and engineering management, but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (I value you being critical, interpreting charitably, and giving feedback.)