2013-11-21



Responsive Website Using BootStrap

If you have not used BootStrap so far, or more than that – have not heard about it – I would recommend you take a closer look to this framework. The fact is that this is really a great choice for those who appreciate the convenience and speed of website development. Today I will tell you about how to create a responsive template using BootStrap 3, which will include elements such as: two navigational menus, slider, promo block, a variety of content blocks, various form elements and footer. One more important moment – in this template, we do not use images, it means that our result is focused on speed.

What does the “Responsiveness” mean?

Responsive Web design is a Web design approach aimed at crafting sites to provide an optimal viewing experience – easy reading and navigation with a minimum of resizing, panning, and scrolling—across a wide range of devices (from mobile phones to desktop computer monitors).

A site designed with Responsive Web design adapts the layout to the viewing environment by using fluid, proportion-based grids, flexible images, CSS3 media queries, an extension of the @media rule.

The fluid grid concept calls for page element sizing to be in relative units like percentages, rather than absolute units like pixels or points.

Flexible images are also sized in relative units, so as to prevent them from displaying outside their containing element.

Media queries allow the page to use different CSS style rules based on characteristics of the device the site is being displayed on, most commonly the width of the browser.

Preview:



Live Demo

download in package

Step 1. HTML

Before you start experimenting with BootStrap framework, let’s prepare a basic html model:

index.html

This is the minimal layout which enables the responsive nature of Twitter Bootstrap. In the header we included all the important meta tags and two CSS files, before the closing body, we added both: jQuery and the minimized bootstrap core. This speeds up the loading of the page. Now we can begin with every element of the page.

Top navigation menu

This menu is in the very top: this is fixed navigation bar. Here is the markup:

Generally, it consists of three parts: the hidden button (for mobile device to open the menu), navbar-brand (brand/title) element, and UL-LI-based drop-down menu.

Slider

Right after the top menu, there is the slider: the carousel which turns its items. Its layout is quite familiar:

The familiar – this is because it contains quite usual elements: the ability to switch slides (indicators), the buttons back and forth, and the slides themselves.

Modal box

Modal boxes are quite an important part of the user interface, so we’ll create one modal box:

Second navigation menu

Finally we come to the main point – the main container which consists of the second navigation menu, footer and additional content blocks. The second menu is not fixed, this is a similar UL-LI-based menu, but the most right element calls the pre-made modal box:

Two column layout with blocks

This section is quite huge, but it is rather simple: blocks are repeated. Just pay attention to my comments:

In the beginning, the whole layout is divided into two columns, but then, the first column is split to another two columns. In the first column, there is the ‘jumbotron’ element, which you can use to put some introduction in there. As I remarked before – all blocks are very similar, here is the markup of the basic block:

In order to change it’s color, you may change its class (panel-default) to one of the following: panel-primary, panel-success, panel-info, panel-warning or panel-danger.

Footer

There is only one unexplained element – footer

Step 2. CSS

By and large – all the things that we’ve created – does not require special styles. Most of possible elements are already defined in BootStrap stylesheet file (bootstrap.min.css). However, there is only one customized element – the slider (carousel):

css/style.css

Live Demo

download in package

Conclusion

In the process of learning the BootStrap framework, we have come to an end. Basically, we only prepared the necessary layout of the page, all the rest has done by this framework. Wonderful, is not it? Thank you for reading this tutorial. Don’t hesitate to share it with your friends using the form below.

Show more