Today I am going to show you how to make your own HTML5 and CSS3 website !
First of all let me show you its final look
Final Look
Structure
What we are upto?
We will make
- index.html (Containing the site HTML 5 Mark up)
- style.css (Containing the styles in CSS3)
- /images/ Folder (For certain images if required)
Basic HTML Mark Up:
Below is the HTML5 basic mark up put it in index.html and start your work.
- <!doctype html>
- <html>
- <head>
- <title>Freakify.com | HTML5 Template | By Ahmad Awais</title>
- <link rel=“stylesheet” href=“style.css” type=“text/css”/>
- </head>
- <body>
- <div id=“content”>
- <header>
- <!–<h1>Your Logo comes Here</h1>–>
- </header>
- <nav id=“navbg” >
- <!–your Navigation–>
- </nav>
- <section id=“banner”>
- <header >
- <!–This is banner–>
- </header>
- </section>
- <section>
- <article>
- <!–Main Contents–>
- </article>
- </section>
- <footer id=“myfooter”>
- <!–Your Footer–>
- </footer>
- </div>
- </body>
- </html>
<header> – The header element is used, such as the page title, logo or Banner.
<nav> - The nav element is for the menu to link with other pages
<section>- It represents a large block, that might be of custom width inside the code
<article> - The article element specifies independent, self-contained content.
<footer> - The footer element is of-course the ending footer of some HTML doc.
Let’s start
Header
- <header>
- <h1>Your Logo comes Here</h1>
- </header>
Navigation
The <nav> part to come here
- <nav id=“navbg” >
- <ul class=“navigation”>
- <li >
- <a href=“/”>Services</a></li>
- <li>
- <a href=“/”>Solutions</a></li>
- <li>
- <a href=“/”>Company</a></li>
- <li >
- <a href=“/”>Home</a></li>
- </ul>
- </nav>
The Banner
The banner can be anything you want (Later you will see I have put an image as banner through background property of CSS)
- <section id=“banner”>
- <header>
- This is banner
- </header>
- </section>
The Main Body
In the main body i have put some fake text using html-ipsum.com .It is the main area where you can put your content !
- <section>
- <article>
- <ul class=“catagories”>
- <li id=“cat1″>
- <h3>Service1</h3>
- <p>Duis diam odio, lacinia nec elementum
- sit amet, faucibus eu nulla. Nulla hendrerit
- interdum turpis sed accumsan. Mauris aliqu
- et sapien adipiscing enim rutrum ultrices. </p>
- <p>Pellentesque habitant morbi tristique senec
- tus et netus et malesuada fames ac turpis eges
- tas. Sed a dui at enim sodales semper id quis risus. </p>
- </li>
- <li id=“cat2″>
- <h3>Service2</h3>
- <p>Duis diam odio, lacinia nec elementum
- sit amet, faucibus eu nulla. Nulla hendrerit i
- nterdum turpis sed accumsan. Mauris aliquet
- sapien adipiscing enim rutrum ultrices. </p>
- <p>Pellentesque habitant morbi tristique senect
- us et netus et malesuada fames ac turpis eg
- estas. Sed a dui at enim sodales semper id quis risus. </p>
- </li>
- <li id=“cat3″>
- <h3>Service3</h3>
- <p>Duis diam odio, lacinia nec elementum sit a
- met, faucibus eu nulla. Nulla hendrerit interdum
- turpis sed accumsan. Mauris aliquet sapien adipis
- cing enim rutrum ultrices. </p>
- <p>Pellentesque habitant morbi tristique senec
- tus et netus et malesuada fames ac turpis egest
- as. Sed a dui at enim sodales semper id quis risus. </p>
- </li>
- <li id=“cat4″>
- <h3>Service4</h3>
- <p>Duis diam odio, lacinia nec elementum sit
- amet, faucibus eu nulla. Nulla hendrerit interd
- um turpis sed accumsan. Mauris aliquet sapie
- n adipiscing enim rutrum ultrices. </p>
- <p>Pellentesque habitant morbi tristique sen
- ectus et netus et malesuada fames ac turpis e
- gestas. Sed a dui at enim sodales semper id quis risus. </p>
- </li>
- </ul>
- </article>
- </section>
The Footer
And at-last the footer ! you an put some social icons here to link up your site with them and some info that relates to the subject of respective site
- <footer id=“myfooter”>
- <ul class=“footer”>
- <li>
- <strong>Links</strong>
- <ul class=“footertext”>
- <li >
- <a href=“/”>Home</a></li>
- <li>
- <a href=“/”>Company</a></li>
- <li>
- <a href=“/”>Services</a></li>
- <li>
- <a href=“/”>Solutions</a></li>
- </ul>
- </li>
- <li>
- <strong> Join in</strong>
- <ul class=“footertext”>
- <li >
- <a href=“/”>Signup</a></li>
- <li>
- <a href=“/”>Promotion</a></li>
- <li>
- <a href=“/”>Fourms</a></li>
- </ul>
- </li>
- <li>
- <strong> Follow Us</strong>
- <ul class=“footertext”>
- <li >
- <a href=“/”>RSS</a></li>
- <li>
- <a href=“/”>Twitter</a></li>
- <li>
- <a href=“/”>FaceBook</a></li>
- <li>
- <a href=“/”>Linkedin</a></li>
- </ul>
- </li>
- </ul>
- </footer>
Full Markup
So here is the complete HTML Markup just copy it all into your index.html if you haven’t been following the above parts
- <!doctype html>
- <html>
- <head>
- <meta charset=“utf-8″ />
- <title>Freakify.com | HTML5 CSS3 site | By Ahmad Awais</title>
- <link rel=“stylesheet” href=“/css/Style.css” type=“text/css”/>
- </head>
- <body>
- <div id=“content”>
- <header>
- <h1>Your Logo comes Here</h1>
- </header>
- <nav id=“navbg” >
- <ul class=“navigation”>
- <li >
- <a href=“/”>Services</a></li>
- <li>
- <a href=“/”>Solutions</a></li>
- <li>
- <a href=“/”>Company</a></li>
- <li >
- <a href=“/”>Home</a></li>
- </ul>
- </nav>
- <section id=“banner”>
- <header>
- This is banner
- </header>
- </section>
- <section>
- <article>
- <ul class=“catagories”>
- <li id=“cat1″>
- <h3>Service1</h3>
- <p>Duis diam odio, lacinia nec elementum sit
- amet, faucibus eu nulla. Nulla hendrerit interdum
- turpis sed accumsan. Mauris aliquet sapien adipiscing
- enim rutrum ultrices. </p>
- <p>Pellentesque habitant morbi tristique senectus et
- netus et malesuada fames ac turpis egestas. Sed a dui at
- enim sodales semper id quis risus. </p>
- </li>
- <li id=“cat2″>
- <h3>Service2</h3>
- <p>Duis diam odio, lacinia nec elementum
- sit amet, faucibus eu nulla. Nulla hendrerit
- interdum turpis sed accumsan. Mauris aliquet
- sapien adipiscing enim rutrum ultrices. </p>
- <p>Pellentesque habitant morbi tristique senectus
- et netus et malesuada fames ac turpis egestas.
- Sed a dui at enim sodales semper id quis risus. </p>
- </li>
- <li id=“cat3″>
- <h3>Service3</h3>
- <p>Duis diam odio, lacinia nec elementum sit amet,
- faucibus eu nulla. Nulla hendrerit interdum turpis
- sed accumsan. Mauris aliquet sapien adipiscing
- enim rutrum ultrices. </p>
- <p>Pellentesque habitant morbi tristique senectu
- s et netus et malesuada fames ac turpis egestas.
- Sed a dui at enim sodales semper id quis risus. </p>
- </li>
- <li id=“cat4″>
- <h3>Service4</h3>
- <p>Duis diam odio, lacinia nec elementum sit amet,
- faucibus eu nulla. Nulla hendrerit interdum turpis s
- ed accumsan. Mauris aliquet sapien adipiscing enim
- rutrum ultrices. </p>
- <p>Pellentesque habitant morbi tristique senectus
- et netus et malesuada fames ac turpis egestas. Sed
- a dui at enim sodales semper id quis risus. </p>
- </li>
- </ul>
- </article>
- </section>
- <footer id=“myfooter”>
- <ul class=“footer”>
- <li>
- <strong>Links</strong>
- <ul class=“footertext”>
- <li >
- <a href=“/”>Home</a></li>
- <li>
- <a href=“/”>Company</a></li>
- <li>
- <a href=“/”>Services</a></li>
- <li>
- <a href=“/”>Solutions</a></li>
- </ul>
- </li>
- <li>
- <strong> Join in</strong>
- <ul class=“footertext”>
- <li >
- <a href=“/”>Signup</a></li>
- <li>
- <a href=“/”>Promotion</a></li>
- <li>
- <a href=“/”>Fourms</a></li>
- </ul>
- </li>
- <li>
- <strong> Follow Us</strong>
- <ul class=“footertext”>
- <li >
- <a href=“/”>RSS</a></li>
- <li>
- <a href=“/”>Twitter</a></li>
- <li>
- <a href=“/”>FaceBook</a></li>
- <li>
- <a href=“/”>Linkedin</a></li>
- </ul>
- </li>
- </ul>
- </footer>
- </div>
- </body>
- </html>
The Mighty CSS3
So let’s start styling our HTML5 Mark up
The Basic CSS
- body
- {
- font-family: ”Lucida Grande”, sans-serif;
- font-size:14px;
- margin:0;
- background-color:#f1f1f1;
- }
- p,h1,h2,h3
- {
- margin-left:5px;
- }
- #content
- {
- width:1002px;
- clear: both; margin: 0 auto;
- }
Styling The Navigation
- ul.navigation {
- padding: 0;
- margin: 0;
- width: 100%;
- }
- ul.navigation li {
- list-style-type: none;
- display: block;
- width: 100px;
- line-height:35px;
- margin:0 15px;
- padding:0 5px;
- float: right;
- text-align: center;
- background:#484BDD;
- margin-top:-10px;
- font-size:16px;
- font-weight:bold;
- }
- ul.navigation li a {
- display: block;
- text-decoration: none;
- color:#FFF;
- }
- ul.navigation li a:hover {
- display: block;
- width: 100px;
- line-height:35px;
- margin-top:-10px;
- text-decoration: none;
- }
- .navigation li:before {
- content:”";
- display:block;
- position:relative;
- left:-15px;
- width:0;
- height:0;
- border-width:5px 5px 5px 5px;
- border-style:solid;
- border-color: transparent #2e3f00 #2e3f00 transparent ;
- }
- #navbg
- {
- display:block;
- background-color:#888888;
- height:35px;
- }
CSS pseudo-elements:
This is an advance topic ! there are three different kinds of pseudo elements like before and after etc
- .navigation li:before {
- content:”";
- display:block;
- position:relative;
- left:-15px;
- width:0;
- height:0;
- border-width:5px 5px 5px 5px;
- border-style:solid;
- border-color: transparent #2e3f00 #2e3f00 transparent ;
- }
Styling The Banner
You can see that I have used the banner.jpg as a background image here
- #banner
- {
- display:block;
- height:250px;
- background-image:url(images/banner.jpg)
- }
Styling the Main Body
- ul.catagories {
- padding: 0;
- margin:0;
- width: 100%;
- }
- ul.catagories li {
- list-style-type: none;
- display: block;
- width: 25%;
- float: left;
- text-align: left;
- background:#5f7e0a;
- }
- li#cat1
- {
- background-color:#E0ECF8;
- }
- li#cat2
- {
- background-color:#A9D0F5;
- }
- li#cat3
- {
- background-color:#58ACFA;
- }
- li#cat4
- {
- background-color:#2E64FE;
- }
Styling The footer
And in the end we are upto style the footer
- #myfooter
- {
- display:block;
- clear:both;
- background-color:#888888;
- height:120px;
- padding:5px;
- }
- ul.footer {
- padding: 0;
- margin: 0;
- list-style: none;
- }
- ul.footer li {
- list-style-type: none;
- display: block;
- margin-right:50px;
- float: left;
- text-align: left;
- line-height:30px;
- color:#FFF;
- }
- ul.footertext {
- padding: 0;
- margin: 0;
- list-style: none;
- }
- ul.footertext li {
- text-align: left;
- float:left;
- clear:both;
- }
- ul.footertext li a {
- text-decoration: none;
- display: block;
- width: auto;
- color: #FFFFFF;
- }
- ul.footertext li a:hover {
- width:auto;
- color: #dff293;
- }
Final Words
Yes , it was that simple. This will work fine in all the browsers except IE and for it
When working with HTML5 today, many of you know that you’ll need to include the “HTML5 shiv” to ensure that CSS will recognize and be able to style those elements in browsers that aren’t yet hip to HTML5.
<!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->Credit for that to Remy Sharp, Jon Neal, John Resig and anybody else who contributed to that idea.



