By default, HTML5 Boilerplate provides two
index.html- a default HTML skeleton that should form the basis of all pages on your website
404.html- a placeholder 404 error page
no-js class is provided in order to allow you to more easily and
.no-js) or enabled (
.js). Using this technique also helps avoid the
Please consider specifying the language of your content by adding a value to the
attribute in the
<html> as in this example:
<html class="no-js" lang="en">
The order of the
The charset declaration (
<meta charset="utf-8">) must be included completely
within the first 1024 bytes of the document
and should be specified as early as possible (before any content that could
be controlled by an attacker, such as a
<title> element) in order to avoid a
potential encoding-related security issue
in Internet Explorer
description meta tag provides a short description of the page.
In some situations this description is used as a part of the snippet
shown in the search results.
<meta name="description" content="This is a description">
Google's Create good meta descriptions documentation has useful tips on creating an effective description.
There are a few different options that you can use with the
tag. You can find out more in the
MDN Web Docs.
HTML5 Boilerplate comes with a simple setup that strikes a good balance for general use cases.
<meta name="viewport" content="width=device-width, initial-scale=1">
If you want to take advantage of edge-to-edge displays of iPhone X/XS/XR you can do so with additional viewport parameters. Check the WebKit blog for details.
Web App Manifest
HTML5 Boilerplate includes a simple web app manifest file.
The web app manifest is a simple JSON file that allows you to control how your app appears on a device's home screen, what it looks like when it launches in that context and what happens when it is launched. This allows for much greater control over the UI of a saved site or web app on a mobile device.
It's linked to from the HTML as follows:
<link rel="manifest" href="site.webmanifest">
Favicons and Touch Icon
The shortcut icons should be put in the root directory of your site.
is automatically picked up by browsers if it's placed in the root. HTML5
Boilerplate comes with a default set of icons (include favicon and one Apple
Touch Icon) that you can use as a baseline to create your own.
Please refer to the more detailed description in the Extend section of these docs.
The Content Area
The central part of the boilerplate template is pretty much empty. This is intentional, in order to make the boilerplate suitable for both web page and web app development.
Browser Upgrade Prompt
The main content area of the boilerplate includes a prompt to install an up to date browser for users of IE 9 and lower. If you intended to support IE, then you should edit or remove the snippet of code.
HTML5 Boilerplate uses a custom build of Modernizr.
html element based on the results of feature test and which ensures that
all browsers can make use of HTML5 elements (as it includes the HTML5 Shiv).
features supported by a browser.
What About Polyfills?
<script src="js/vendor/modernizr-3.8.0.min.js"></script> <script src="https://cdn.polyfill.io/v3/polyfill.min.js"></script> <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> <script>window.jQuery || document.write('<script src="js/vendor/jquery-3.4.1.min.js"><\/script>')</script> <script src="js/plugins.js"></script> <script src="js/main.js"></script> </body>
If you like to just include the polyfills yourself, you could include them in
js/plugins.js. When you have a bunch of polyfills to load in, you could
also create a
polyfills.js file in the
js/vendor directory or include the files
individually and combine them using a build tool. Always ensure that the polyfills
There are some misconceptions about Modernizr and polyfills. It's important to understand that Modernizr just handles feature checking, not polyfilling itself. The only thing Modernizr does regarding polyfills is that the team maintains a huge list of cross Browser polyfills.
jQuery CDN for jQuery
The jQuery CDN version was chosen over other potential candidates (like Google's Hosted Libraries) because it's fast (comparable or faster than Google by some measures) and, (unlike Google's CDN) is available to China's hundreds of millions of internet users. For many years we chose the Google Hosted version over the jQuery CDN because it was available over HTTPS (the jQuery CDN was not,) and it offered a better chance of hitting the cache lottery owing to the popularity of the Google CDN. The first issue is no longer valid and the second is far outweighed by being able to serve jQuery to users in China.
While the jQuery CDN is a strong default solution your site or application may require a different configuration. Testing your site with services like WebPageTest and browser tools like PageSpeed Insights will help you examine the real world performance of your site and can show where you can optimize your specific site or application.
Google Universal Analytics Tracking Code
Finally, an optimized version of the Google Universal Analytics tracking code is included.
analytics.js rather than the newer
it's faster and supports tasks and plugins
The beacon transport mechanism is used to send all hits which saves HTTP requests and improves performance.
Google recommends that this script be placed at the top of the page. Factors to consider: if you place this script at the top of the page, you’ll be able to count users who don’t fully load the page, and you’ll incur the max number of simultaneous connections of the browser.
N.B. The Google Analytics snippet is included by default mainly because Google Analytics is currently one of the most popular tracking solutions out there. However, its usage isn't set in stone, and you SHOULD consider exploring the alternatives and use whatever suits your needs best.