knowledge-kitchen

Bootstrap - Yesteryear's Favorite Front-End Framework, Today's Bloatware?

easy responsive design for the masses

  1. Front-End Frameworks
  2. Boostrap Overview
  3. CSS Reset
  4. New Baseline CSS Styles
  5. Responsive Design
  6. Grid Layout System
  7. Readymade Javascript Code
  8. Conclusions

Front-End Frameworks

Concept

Front-end frameworks, of which Bootstrap is one, are toolkits that help web developers create the front-end - the visible user interfaces of web pages and applications.

Boostrap Overview

Evolution

Bootstrap was originally created by two developers at Twitter in 2010 as a sort of style guide for internal projects

Concept

Bootstrap is a free collection of code for simplifying the creation of websites and web applications. It contains …

Installation

Project setup

Since Bootstrap consists of CSS and Javascript code, it is necessary to simply link them to a project’s HTML documents.

<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>

Project setup (continued)

You may have noticed that the example code links to the JQuery Javascript file

Alternative

Rather than download the Bootstrap and JQuery files into your own project directories, you can load them from a Content Deliver Network’s (CDN) servers offered for free by both projects.

Customization

While Bootstrap’s new CSS styles and Javascript-enhanced interface components are useful and save time, you will inevitably want to customize some of the CSS styles and Javascript behaviors of your web pages.

<link rel="stylesheeet" type="text/css" href="css/custom.css" />
<script type="text/javascript" src="js/custom.js"></script>

CSS Reset

Concept

A CSS reset is a set of CSS code that removes or overrides the default CSS stylesheets used by web browsers.

New Baseline CSS Styles

Concept

Bootstrap overrides the browser’s default styles with a set of more contemporary CSS defaults that are easy for developers to customizee.

Responsive Design

Concept

Bootstrap’s CSS code includes media queries to make a breakpoint-based responsive design at the following breakpoints:

Usage

To take advantage of Bootstrap’s responsive design features, you must enclose all of your HTML content into a div element with the class container.

<!DOCTYPE html>
<html>
  <head>
    <!-- Link to Bootstrap and JQuery files -->
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
    <script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <!-- Link to your own custom CSS and Javascript files -->
    <link rel="stylesheeet" type="text/css" href="css/custom.css" />
    <script type="text/javascript" src="js/custom.js"></script>
  </head>
  <body>
    <div class="container">
      <h1>The page width is now responsive!</h1>
    </div>
  </body>
</html>

Grid Layout System

Concept

Bootstrap makes it easy to place any element at a particular position on the page as well as to specify the size of that element at all responsive breakpoints.

Usage

For example, the following code, if placed within the container div would create two articles each taking up 1/2 of the available width at all responsive breakpoints.

<div class="row">
  <article class="col-6">First article</article>
  <article class="col-6">Second article</article>
</div>
<div class="row">
  <article class="col-12 col-md-6">First article</article>
  <article class="col-12 col-md-6">Second article</article>
</div>

Readymade Javascript Code

Concept

Some common user interface components require Javascript code to implement.

Conclusions

You have now seen the joy of the Bootstrap front-end framework.