Welcome

Welcome to CMS n Web. Learn & Study completely Free Articles\Training about Web Designing\Development and CMS.

Search This Web

Sunday, July 28, 2013

How to Create a Responsive Website in About 15 Minutes

The buzz around responsive design has been going on for several months now, and a lot of websites are already responsive, or underway. You know what that means? Today I will teach you how to create a responsive website.
If you follow 1WD on Facebook or Twitter, then you already know that we’re already preparing for an explosive design, which includes being responsive. Watch out for it!
  • Tutorial Level: Beginner
  • Skills Required: Basic knowledge in HTML and CSS
  • Completion Time: Approximately 15 minutes
  • Warning: this tutorial is targeted towards beginners, but it can also be for designers and developers who want to have fun!
By the end of this quick tutorial about responsive design, you will already be on your way to web stardom, and by that I mean you’ll be ready to convert and create responsive websites!
Are you ready? Show me your war faces! Roaaar!

Preparing for the Responsive Website Tutorial

I promised that it will only take about 15 minutes to create a responsive website, and I will hold true to my words. Only, we shall start slow and small. We will start by creating a simple single-page website. Cool? Okay!
Frameworks you can use:

What is Responsive Design?

If you are fairly new to the term, then we have the perfect reading materials for you!

Our Goal

How to Create a Responsive Website in About 15 Minutes

By the end of this tutorial you will end up with something similar to the page above. It is a very plain design, but it will do the trick for now. It is fairly easy to clone the image as seen above, but the main goal here is to make it responsive. To make the website respond based on the size of your device’s screen size.
Try opening the demo on your smartphone and you will see this:
How to Create a Responsive Website in About 15 Minutes

This is what Foundation can do along with several other frameworks that focuses on making websites responsive for mobile devices.
You will find all the files, including the images, in the download link below.


Before moving on, download Foundation and unzip it to a folder where all of your files for this tutorial will be located. It should look like this:

Open index.html and see several elements blasted in one page as a demo. We won’t use everything you will see in it, but you can learn a lot from it. Now, delete it or move it somewhere else so that we can start from scratch.

Our Goal:

Our goal is to create a webpage which has the basic areas of a website: header, body, sidebar, and footer. Of course everything will be responsive, from images down to text and elements placement.

Step 1: Understanding the Foundation

Okay, it is already a given that we will use the structure above, but how will we translate that to HTML? Easy!
First, you need to understand a few things about Foundation and how layouting works. It uses 12 columns to define the width of each “section” which is derived from foundation.css’ width of 1000px. So, if we write:
1<div class="row">
2
3    <div class="twelve columns">
4
5    </div>
6
7</div>
The above code would mean that in this certain row, you will occupy twelve columns with the width of 1000px. While on the code below:
1<div class="row">
2
3     <div class="twelve columns">
4
5         <div class="six columns">
6
7         </div>
8
9         <div class="six columns">
10
11         </div>
12
13     </div>
14
15</div>
We placed two “six columns” inside of “twelve columns”, this would mean that “six columns” will occupy 50% of the width of “twelve columns”.  The same is true for other number of columns:
1<div class="row">
2
3     <div class="twelve columns">
4
5         <div class="row">
6
7         <div class="seven columns">
8
9              <div class="row">
10
11                   <div class="twelve columns">
12
13                   </div>
14
15              </div>
16
17         </div>
18
19         <div class="five columns">
20
21         </div>
22
23     </div>
24
25</div>
For “seven columns” we placed another row inside which occupies “twelve columns”. This means that “twelve columns” will take the maximum width of “seven columns” and divide it into “twelve columns”. It’s a nest of rows and columns, which is important for our goal layout. Now that rows and columns, and nested columns, have been explained, let’s move on to the main show.

Step 2: Laying Out the Foundation

Using your favorite text editor, create a file named index.html then add the following at the very beginning of the file:
1<!-- Rean's note: if you're wondering what are these items below, you should follow the link below -->
2
3<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
4
5<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
6
7<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
8
9<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
10
11<!--[if gt IE 8]><!-->  <!--<![endif]-->
12
13  <!-- Set the viewport width to device width for mobile -->
14
15  Welcome to Foundation
16
17  <!-- Included CSS Files -->
18
19  <!--[if lt IE 9]>
20
21                <link rel="stylesheet" href="stylesheets/ie.css">
22
23  <![endif]--><script type="text/javascript"src="javascripts/modernizr.foundation.js"></script>
24
25  <!-- IE Fix for HTML5 Tags -->
26
27  <!--[if lt IE 9]>
28
29    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
30
31  <![endif]-->
The above code is where we deal with the evil of Internet Explorer. It is also where we call on to different stylesheets which are necessary to make the whole thing responsive and run on mobile devices. It comes with Foundation. Then type the following code:
1<div class="row">
2
3      <div class="twelve columns">
4
5           <h2>Header Twelve Columns</h2>
6
7      </div>
8
9</div>
10
11<div class="row">
12
13      <div class="twelve columns">
14
15           <div class="row">
16
17              <div class="seven columns">
18
19                  <h3>Body Seven Columns</h3>
20
21             </div>
22
23               <div class="five columns">
24
25                  <h3>Sidebar Five Columns</h3>
26
27              </div>
28
29           </div>
30
31      </div>
32
33</div>
34
35<div class="row">
36
37      <div class="twelve columns">
38
39          <h2>Footer Twelve Columns</h2>
40
41      </div>
42
43</div>
I have already explained what these “rows” and “twelve columns” are above.
Tip: if it’s not clear to you why we should wrap the sidebar and body with “twelve columns” you can try removing it and see what happens!
By now it should look like this:

We haven’t added stylings yet, but you can already see how it jives with our goal. I’m not much of a designer but I will do my best to make this look amazing.
Wait, wait, wait! What’s that navigation bar, you ask? As I have mentioned earlier, this is one of the beauties of Foundation. It has an extensive documentation that will teach you how to properly use forms, navigations, buttons, grids, CSS, and other elements covered by Foundation.
Everything is basically done now, all we need to do is add some images and paragraphs and design the whole thing. If you followed this tutorial, then by now you have already created your first responsive web page!

Step 3: Adding Content

This step is needed to actually see how the webpage will look like in its full glory. Copy some Lorem Ipsum and paste it on your “body” div, then insert images using <img> tag and then you’re on your way to becoming a superstart with this!
If you’ll go back and check the demo, you might notice that the background isn’t exactly white, but with a subtle pattern. Choose one on SubtlePatterns and see for yourself which works best.

Step 4: There is no Step 4

Well, actually there is a step 4. The next thing you need to do is study the files you downloaded and start creating your own responsive web page from scratch. There are a lot of other tools you can use aside from Foundation, but the idea is basically the same. Don’t forget to check the documentation!
What do you think about this tutorial? This is my first time writing one, and it may appear messy to experts, but comments and suggestions are always welcome so that we can all improve, right? Start typing now!

Looking for a Great Web Host?

We highly recommend Bluehost!