Shaun Mccran

My digital playground


Creating a baseline HTML 5 document

Browser standards and cutting edge web design are not great bedfellows. I've heard the arguments from creative designers that you have to write specific browser CSS styles to accommodate the multitude of browsers and their own unique way of rendering CSS.

I disagree. I firmly believe that with a good understanding of the structure of CSS elements and how they interact with each other you can develop a completely cross-browser non JavaScript baseline template. This article explains how I have approached creating a HTML 5 layout file, that works across legacy browsers just as well as the more modern interpreters.

Firstly I'd like to point out that the demo included here has no actual styling attached to it. I am aiming to creating a baseline template that anyone can drop into a directory to kick off a new project. I'm not too bothered about the look and feel at the moment.

Goal 1 - The same output in all supported browsers

To clarify 'supported browsers' I mean almost everything post Internet Explorer 6. I totally agree with the 'kill IE 6' campaign and unless someone makes a serious case as to why I should, I do not support it anymore. I've come around to thinking that it is ok now to point people towards upgrading their browser as they will have a poor experience using legacy browsers.

If you take a look at the Demo here: in any of your browsers you should see exactly the same thing. It should be identical, I mean all of it. The margins, spacing and fonts etc are all the same.

The key to starting any project, is to have a clean slate. Try and keep your layout and styling separate, and as I have done here I really, really, recommend using a reset Style sheet. In this way all of the elements a browser does not recognise are handled like Div elements.

This is what I'm using as a reset CSS at the moment.

view plain print about
1a, abbr, acronym, address, applet, article, aside, audio,
2b, blockquote, big, body,
3center, canvas, caption, cite, code, command,
4datalist, dd, del, details, dfn, dl, div, dt,
5em, embed,
6fieldset, figcaption, figure, font, footer, form,
7h1, h2, h3, h4, h5, h6, header, hgroup, html,
8i, iframe, img, ins,
9kbd, keygen,
10label, legend, li,
13object, ol, output,
14p, pre, progress,
16s, samp, section, small, span, source, strike, strong, sub, sup,
17table, tbody, tfoot, thead, th, tr, tdvideo, tt,
18u, ul,
19var {
20 background:transparent;
21 border:0 none;
22 font-size:100%;
23 margin:0;
24 padding:0;
25 border:0;
26 outline:0;
27 vertical-align:top;
31ul {
32    list-style:none;
35q {
36    quotes:none;
39table td {
40    padding:0;
41    border:none;
42    border-collapse:collapse;

Goal 2 - No optional technology

This is a simple principle really. Do not create elements of a site/application that rely on option technology, such as JavaScript. If it is possible for users to block or disable the technology that you are using then do not rely on it for a critical part of your site.

There must be a guaranteed baseline user experience for everyone. By using the Reset CSS file above rather than a JavaScript HTML 5 workaround you are ensuring this.

In this way all Browsers will work in the same way, without the need for user buy in to specific technology. This is the code version of my HTML 5 baseline template, you can see it rendered here ( demo of a HTML 5 template)

This template has been successfully validated using the W3C markup service as valid HTML 5:

view plain print about
2<html lang="en-GB">
4<meta charset="UTF-8">
5<link rel="stylesheet" href="reset.css" type="text/css" media="all">
6<title>HTML 5 template</title>
11<!-- header -->
14    <!-- navigation -->
15    <nav>
16        <ul>
17            <li>nav item 1</li>
18            <li>nav item 2</li>
19            <li>nav item 3</li>
20            <li>nav item 4</li>
21        </ul>
22    </nav>
23    <!-- end nav -->
26<!-- end of header -->
28<section id="content">
29    <h1>Header 1</h1>
31    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas auctor dolor in erat venenatis quis vulputate mauris aliquet.
32    Aliquam nec urna porta odio accumsan convallis. Curabitur ut orci orci, eget posuere enim. Etiam est elit, pulvinar id
33    malesuada id, bibendum sed purus. Sed arcu magna,
35    <article>
36        <h2>Header 2</h2>
37        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas auctor dolor in erat venenatis quis vulputate mauris aliquet.
38        Aliquam nec urna porta odio accumsan convallis. Curabitur ut orci orci, eget posuere enim. Etiam est elit, pulvinar
39        id malesuada id, bibendum sed purus. Sed arcu magna,
40    </article>
44<!-- bottom aside area -->
45<aside class="wrapper">
49<!-- footer -->
53<!-- end of footer -->
56<!-- GA tracking -->
57<script type="text/javascript">
58    var _gaq = _gaq || [];
59    _gaq.push(['_setAccount', 'UA-']);
60    _gaq.push(['_setDomainName', '']);
61    _gaq.push(['_trackPageview']);
63 (function() {
64 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
65 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
66 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
67 })();

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Sami Hoda's Gravatar Why wouldn't you use the html5 boilerplate code?
# Posted By Sami Hoda | 14/08/2011 10:35
Shaun's Gravatar Hi Sami,

Yes, I suppose I could have used the boilerplate code, I've arrived at this example myself though, so I quite like using code I've evolved myself. I always feel like I know it more, and I understand what each element is actually doing.

I'm a very 'learn by doing' kind of person.
# Posted By Shaun | 14/08/2011 14:00
Jeremy Halliwell's Gravatar btw in your stylesheet link tag you don't need to include type="text/css" any more, as the MIME type is implied by the filename.
# Posted By Jeremy Halliwell | 15/08/2011 01:50
Shaun McCran's Gravatar Hi Jeremy,

That's a good spot, I'll give it a try and make sure it still validates, I find it much more interesting evolving documents like this.
# Posted By Shaun McCran | 15/08/2011 02:12
Phillip Senn's Gravatar I put:

JavaScript is disabled.
<!--[if lt IE 9]>
<script src=";

in the footer.
# Posted By Phillip Senn | 15/08/2011 06:37
salmanonline's Gravatar Thanks for such a valuable post. keep sharing more like this.
# Posted By salmanonline | 15/12/2015 15:09
salman9708's Gravatar users on this forum can also get some good content here.
# Posted By salman9708 | 15/12/2015 15:10
free blogger template's Gravatar the post about creating HTML baseline is really easy for pro but with the help of your post it is even easy for newbies.... check more at
# Posted By free blogger template | 15/12/2015 22:18
free blogger themes's Gravatar Thanks for sharing such an informative post. your content seems quite easy and helpful to understand.
# Posted By free blogger themes | 16/12/2015 05:29
Katrina Kaif HD Wallpapers,Images Download 2015's Gravatar Thanks for the wonderful share. keep doing the same in the near future. Get Katrina Kaif HD Wallpapers,Images Download 2015 in 1080p Resolution. Katrina Kaif images download, Katrina Kaif wallpaper hd, Katrina Kaif photos hd from
# Posted By Katrina Kaif HD Wallpapers,Images Download 2015 | 19/12/2015 15:07
best whatsapp dp images |'s Gravatar Wonderful post. It was worth reading it. Thanks for sharing. Do check out to download best whatsapp dp images for your whatsapp display picture.
# Posted By best whatsapp dp images | | 25/12/2015 17:56
desi girls's Gravatar Good Post. I really love the way you have shared the post here among your readers. Now download desi girl images, photos and hd pics from to beautify your pc desktop background.
# Posted By desi girls | 25/12/2015 17:58
kajal agarwal hd wallpapers,pics,images,photos's Gravatar Thanks for sharing this post.
<a href=" agarwal hd wallpapers,pics,images,photos</a>
# Posted By kajal agarwal hd wallpapers,pics,images,photos | 09/01/2016 03:26
mia khalifa hd wallpapers,pics,images,photos's Gravatar Nice blog its easy to understand.
<a href=" khalifa hd wallpapers,pics,images,photos</a>
# Posted By mia khalifa hd wallpapers,pics,images,photos | 09/01/2016 03:29
Back to top