6 min read

In this article written by Snig Bhaumik, author of the book Bootstrap Essentails, we explain the concept of Bootstrap, responsive design patterns, navigation patterns, and the different components that are included in Bootstrap.

(For more resources related to this topic, see here.)

Responsive design patterns

Here are the few established and well-adopted patterns in Responsive Web Design:

  • Fluid design: This is the most popular and easiest option for responsive design. In this pattern, larger screen multiple columns layout renders as a single column in a smaller screen in absolutely same sequence.
  • Column drop: In this pattern also, the page gets rendered in a single column; however, the order of blocks gets altered. That means, if a content block is visible first in order in case of a larger screen, that might be rendered as second or third in case of a smaller screen.
  • Layout shifter: This is a complex but powerful pattern where the whole layout of the screen contents gets altered in case of a smaller screen. This means that you need to develop different page layouts for large, medium, and small screens.

Navigation patterns

You should take care of the following things while designing a responsive web page. These are essentially the major navigational elements that you would concentrate on while developing a mobile friendly and responsive website:

  • Menu bar
  • Navigation/app bar
  • Footer
  • Main container shell
  • Images
  • Tabs
  • HTML forms and elements
  • Alerts and popups
  • Embedded audios and videos, and so on

You can see that there are lots of elements and aspects you need to take care of to create a fully responsive design. While all of these are achieved by using various features and technologies in CSS3, it is of course not an easy problem to solve without a framework that could help you do so. Precisely, you need a frontend framework that takes care of all the pains of technical responsive design implementation and releases you only for your brand and application design.

Now, we introduce Bootstrap that would help you design and develop a responsive web design in a much optimized and efficient way.

Introducing Bootstrap

Simply put, Bootstrap is a frontend framework for faster and easier web development in the new standard of mobile-first philosophy. It uses HTML, CSS, and JavaScript. In August 2010, Twitter released Bootstrap as Open Source.

There are quite a few similar frontend frameworks available in the industry, but Bootstrap is arguably the most popular framework in the lot. It is evident when we see Bootstrap is the most starred project in GitHub since 2012.

Until now, you must be in a position to fathom why and where we need to use Bootstrap for web development; however, just to recap, here are the points in short.

  • The mobile-first approach
  • A responsive design
  • Automatic browser support and handling
  • Easy to adapt and get going

What Bootstrap includes

The following diagram demonstrates the overall structure of Bootstrap:

Bootstrap Essentials

CSS

Bootstrap comes with fundamental HTML elements styled, global CSS classes, classes for advanced grid patterns, and lots of enhanced and extended CSS classes.

For example, this is how the HTML global element is configured in Bootstrap CSS:

html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}

This is how a standard HR HTML element is styled:

hr {
height: 0;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}

Here is an example of new classes introduced in Bootstrap:

.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

Components

Bootstrap offers a rich set of reusable and built-in components, such as breadcrumbs, progress bars, alerts, and navigation bars. The components are technically custom CSS classes specially crafted for the specific purpose.

For example, if you want to create a breadcrumb in your page, you simply add a DIV tag in your HTML using Bootstrap’s breadcrumb class:

<ol class="breadcrumb">
<li><a href="#">Home</a></li>
<li><a href="#">The Store</a></li>
<li class="active">Offer Zone</li>
</ol>

In the background (stylesheet), this Bootstrap class is used to create your breadcrumb:

.breadcrumb {
padding: 8px 15px;
margin-bottom: 20px;
list-style: none;
background-color: #f5f5f5;
border-radius: 4px;
}
.breadcrumb > li {
display: inline-block;
}
.breadcrumb > li + li:before {
padding: 0 5px;
color: #ccc;
content: "/0a0";
}
.breadcrumb > .active {
color: #777;
}

Please note that these set of code blocks are simply snippets.

JavaScript

Bootstrap framework comes with a number of ready-to-use JavaScript plugins. Thus, when you need to create Popup windows, Tabs, Carousels or Tooltips, and so on, you just use one of the prepackaged JavaScript plugins.

For example, if you need to create a tab control in your page, you use this:

<div role="tabpanel">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#recent" aria-controls="recent" role="tab" data-toggle="tab">Recent Orders</a></li>
<li role="presentation"><a href="#all" aria-controls="al" role="tab" data-toggle="tab">All Orders</a></li>
<li role="presentation"><a href="#redeem" aria-controls="redeem" role="tab" data-toggle="tab">Redemptions</a></li>
</ul>
 
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="recent"> Recent Orders</div>
<div role="tabpanel" class="tab-pane" id="all">All Orders</div>
<div role="tabpanel" class="tab-pane" id="redeem">Redemption History</div>
</div>
</div>

To activate (open) a tab, you write this JavaScript code:

$('#profileTab li:eq(1) a').tab('show');

As you could guess by looking at the syntax of this JavaScript line that the Bootstrap JS plugins are built on top of jQuery. Thus, the JS code you would write for Bootstrap are also all based on jQuery.

Customization

Even though Bootstrap offers most (if not all) standard features and functionalities for Responsive Web Design, there might be several cases when you would want to customize and extend the framework. One of the very basic requirements for customization would be to deploy your own branding and color combinations (themes) instead of the Bootstrap default ones. There can be several such use cases where you would want to change the default behavior of the framework.

Bootstrap offers very easy and stable ways to customize the platform.

When you use the Bootstrap CSS, all the global and fundamental HTML elements automatically become responsive and would properly behave as the client device on which the web page is browsed.

The built-in components are also designed to be responsive. As the developer, you shouldn’t be worried about how these advanced components would behave in different devices and client agents.

Summary

In this article we have discussed the basics of Bootstarp along with a brief explanation on the design patterns and the navigation patterns.

Resources for Article:


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here