The Worldâs Best HTML Template
Published on April 29, 2008 (⻠February 5, 2024), filed under Development (RSS feed for all categories).
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.
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
Iâm Jens (long: Jens Oliver Meiert), and Iâm a frontend engineering leader and tech author/publisher. Iâve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, Iâm a contributor to several web standards, 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 views and experiences. (Be critical, interpret charitably, and send feedback.)
Comments (Closed)
-
On April 29, 2008, 23:45 CEST, Sminky said:
What would be different in HTML5? And why is that any better than XHTML? This template is looking clean I must admit.
-
On April 30, 2008, 16:34 CEST, bill weaver said:
Hi, Jens.
I think you need to close your elements. For example:
<link ⊠/>
<meta ⊠/>And though you have it fixed in the download, your snippit in this article needs head and body tags.
-
On April 30, 2008, 17:14 CEST, Jens Oliver Meiert said:
Sminky, the first difference in HTML 5 will be the document type (case-insensitive
<!DOCTYPE html>
; itâs better than XHTML because almost nobody uses XHTML (not when delivered astext/html
); it saves code (and therefore time); it can be more efficient.Bill, it is HTML, so these elements donât need to be closed. Apart from the annotations the code above is not any different than the template (which is valid, of course).
-
On May 1, 2008, 13:12 CEST, Dennison Uy said:
Jens, I agree with Bill, you should at least close your tags and include the HEAD and BODY tags. As it is this is very far from being the Worldâs Best HTML Template
-
On May 1, 2008, 22:08 CEST, jesper said:
Beautiful. This IS the best template because it is what you need. Just basic minimal structure, with a 100% guarantee that it is needed. Unlike the rest of all those templates that clutter your site with crao nobody ever needs.
It is however, probably too much to understand for developers just discovering all hyped XHTML đ
-
On May 4, 2008, 11:05 CEST, David said:
For framework lovers itâs crap, for anyone else itâs good - if they canât easily create it themselves. Good point however.
-
On June 4, 2008, 18:59 CEST, Richard Morton said:
But would it be accessible? It certainly passes guidelines from the point of view of code validation and using CSS for layout, but it would probably fail the checkpoint about structuring content with headings (I say probably only because it could be argued that say a one paragraph website may not need a heading at all).
-
On June 5, 2008, 10:38 CEST, Jens Oliver Meiert said:
Richard, well, donât focus on the exemplary
p
element. Itâs a placeholder for whatever the document in question consists of, and the document should of course use an appropriate structure. -
On July 26, 2008, 14:48 CEST, Bryan said:
I am looking for the âWorlds Best HTML Templateâ to download but cannot find it.
Can you please tell me how I can find the link to download? I am assuming that it resembles the page I am reading as I REALLY LOVE this pages layout.
Does it have a backend manager for the comments? Can I use Captcha on it?
Pleas elet me know I just have to have it!
Thank you and kind regards,
Bryan -
On August 21, 2008, 13:27 CEST, Drenthe said:
I think this wonât be xhtml validâŠ
-
On December 8, 2008, 23:45 CET, miryam said:
thanks for the template, about the language codes, if our site is done in english and lets say spanish, the code can have both languages?
-
On December 9, 2008, 13:19 CET, Stu said:
Hello, I have a question about the doctype.
Its seems to be kind of incomplete, even if I know it validates. I wonder why it does that without the url at the end. On w3.org i only find âcompleteâ doctypes.
Some people say modern browsers would render a document in quirks-mode if the url is missing but Firefox 3.0.4 claims in his infowindow for your template: âstandartconforming-modeâ.
Thanks if you could explain it to me.
I am absolute fascinated by the behavior of building a complete DOM out of an âincompleteâ html-source. I like its cleverness. I would love to use a shorter doctype, because I hate that thing at all. The HTML5 one looks much more elegant.
Read More
Maybe of interest to you, too:
- Next: Website Optimization Measures, Part IV
- Previous: Why âResetâ Style Sheets Are Bad
- More under Development
- More from 2008
- Most popular posts
Looking for a way to comment? Comments have been disabled, unfortunately.
Get a good look at web development? Try WebGlossary.infoâand The Web Development Glossary 3K (2023). With explanations and definitions for thousands of terms of web development, web design, and related fields, building on Wikipedia as well as MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.