Have you likely heard of Bootstrap? What do you know about that. According to the official website, Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.
This guide is meant as a first look into Bootstrap for beginners, so won’t be going into LESS and Sass integration, which are more intermediate/advanced concepts. While it’s written for the current, stable version Bootstrap 4, the concepts will remain the same for future versions.
Before starting, it’s important for you to understand HTML and CSS first, at least fundamentally.
Is the framework important?
You absolutely don’t need to use a framework to build a website design. But, the framework is to help you to build a responsive web design easily and quickly. Frameworks are very popular and have many benefits, so it’s important to learn how to work with them.
Some of the ways that frameworks can help you:
- Prevent repetition between projects
- Utilize responsive design to allow your website to adapt to various screen sizes.
- Add consistency to design and code.
- Quickly and easily prototype new designs
- Ensure cross-browser compatibility
Generally, every web project you work on will need to be responsive and work properly on all the major browsers, and likely have some fallbacks for older browsers. Bootstrap has a huge open source community that works on covering this so you don’t have to. Additionally, when multiple developers all know the same system, they can work in better harmony – and it also makes it easier for newcomers on a project to get up to speed.
To use bootstrap you need at least these 3 main file below!
- bootstrap.css – a CSS framework.
- popper.js – plugins (optional).
The grid is probably one of the most essential aspects of the framework. It’s the basis on which the entire layout is created. Generally, the bootstrap has 4 different sizes for each device type, xs for mobile, sm for tablet/mobile on landscape mode, lg for laptop/tablet on landscape mode, and xl for desktop. The calculation is that each full screen has a total of 12 columns. See the image below.
Okay let’s begin!
Building basic template
Firstly, create some directory as we need, like css, and js folder. Download the latest version of bootstrap here. Put bootstrap.css to the CSS folder and bootstrap.js to the js folder. Don’t forget to download jQuery here and choose version 3.5.1 and put it to the js folder. It looks like:
For alternatively you can use bootstrap CDN.
<link rel="stylesheet"> href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
Further, we need to create a index.html. I recomended to use HTML5 boilerplate template, because this template is standar for every responsive website. Or view simple example to start from, see code below:
<!-- Required meta tags -->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- jQuery first, then Bootstrap JS -->
Well done, we have made a simple hello world template with bootsrap. Now, let’s check out our awesome new site.
See what we work with bootstrap. About free templates that’s build with bootstrap. See Our projects