HTML5 Boilerplate – Beginners Guide for Web Developers
HTML5 Boilerplate.
This tutorial is connected from the previous HTML5 tutorial, the “HTML5 Shiv or Shim“.
In this tutorial, you will know what HTML5 Boilerplate intended to HTML5 and lets you create awesome HTML5 site without starting from scratch.
Click here to download the latest HTML5 boilerplate.
So, what HTML5 Boilerplate contains?
- Google Analytics Snippet
- Normalize.css
- jQuery using Google CDN
- Modernizr
These features of HTML5 Boilerplate can be explained on the HTML5 Boilerplate website provided on top of the features.
Now, let’s download the HTML5 Boilerplate and create a new folder named “boilerplate” from our recent HTML5 document, then extract it on the said folder.
So, let me explain to you about the contents inside the HTML5 Boilerplate.
Let us discuss about the humans.txt file:
[text]
# humanstxt.org/
# The humans responsible & technology colophon
# TEAM
<name> — <role> — <twitter>
# THANKS
<name>
# TECHNOLOGY COLOPHON
CSS3, HTML5
Apache Server Configs, jQuery, Modernizr, Normalize.css
[/text]
This is a great idea because you can know how you can give cross settings to robots.txt. humans.txt is for humans to look at it so that if you are on a site and you want to see a little bit more about the site to yourself.
You can self type and /humans.txt then you can get the THANKS, the TECHNOLOGY they are using, the TEAM and it is really a great idea. In fact, when you usually go to a site and you can see they are using humans.txt and you will know the guys are with it and it is really helpful and learn more about the project.
Next, let’s check out the index file located at your “boilerplate” folder:
[html5]
<!doctype html>
<html class=”no-js” lang=””>
<head>
<meta charset=”utf-8″>
<meta http-equiv=”x-ua-compatible” content=”ie=edge”>
<title></title>
<meta name=”description” content=””>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”apple-touch-icon” href=”apple-touch-icon.png”>
<!– Place favicon.ico in the root directory –>
<link rel=”stylesheet” href=”css/normalize.css”>
<link rel=”stylesheet” href=”css/main.css”>
http://js/vendor/modernizr-2.8.3.min.js
</head>
<body>
<!–[if lt IE 8]>
<p class=”browserupgrade”>You are using an <strong>outdated</strong> browser. Please <a href=”http://browsehappy.com/”>upgrade your browser</a> to improve your experience.</p>
<![endif]–>
<!– Add your site or application content here –>
<p>Hello world! This is HTML5 Boilerplate.</p>
https://code.jquery.com/jquery-1.12.0.min.js
window.jQuery || document.write(”)
http://js/plugins.js
http://js/main.js
<!– Google Analytics: change UA-XXXXX-X to be your site’s ID. –>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src=’https://www.google-analytics.com/analytics.js’;
r.parentNode.insertBefore(e,r)}(window,document,’script’,’ga’));
ga(‘create’,’UA-XXXXX-X’,’auto’);ga(‘send’,’pageview’);
</body>
</html>
[/html5]
As you can see the !DOCTYPE html is indicated there which this index file is an HTML5 document. The html file gives classes to our body based on what version of IE it is. Its basically giving us everything we need to start our project out.
Also, the default .css files are there, the normalize and main .css’ which have some basic styles for your HTML5 document. It also has some great print style stuff.
Basically, if you are on your old version of IE the html file is gonna give you a chromeframe notice that is going to allow you to install the chromeframe plug-in that lets your browser use modern features which is a great thing to you.
Then, you can see the google’s version of jQuery where their google is hosted and also a back-up of our own that is located on the boilerplate/js/vendor folder.
Also, there’s two default javascripts like the plugin.js and main.js.
So, later on if you want to put your plugins and your HTML5 document and jQueries and JavaScripts, you can put these on your blank plugin.js for plugins and main.js for jQueries and JavaScripts.
Also, on the last part of the HTML5 document, you can see a Google Analytics Script which can be helpful to where we can put our site’s ID.
It is not really a ton of stuff but it is really helpful in terms of creating your own HTML5 project without starting from scratch.
On our next tutorial, we will be discussing about Page Structure – Coding a Blogsite. Stay tuned webbies!
For questions or any other concerns or thesis/capstone creation with documentation, you can contact me through the following:
E-Mail: [email protected]
Facebook: facebook.com/kirk.lavapiez
Contact No.: +639771069640
Ian Hero L. Lavapiez
BSIT Graduate, soon to be MIT.
System Analyst and Developer
Related topic(s) that you may like: