Javatpoint Logo
Javatpoint Logo

Bootstrap 4 - Environment Setup

Bootstrap 4 is the latest version of Bootstrap. In this section, it is shown how to download and setup Bootstrap 4.

There are two ways of using Bootstrap 4 in the Website:

  1. The first method that can be used is to start using Bootstrap 4 by inserting it from the CDN which stands for Content Delivery Network.
  2. And the second method is to download it from getbootstrap.com.

Using CDN

The Bootstrap 4 can be used in the website by inserting it from the CDN which is short for - Content Delivery Network.

The code given below can be used to compile the Bootstrap's CDN of CSS and JS in the project.

In this process, also insert the CDN versions of jQuery and Popper.js which is used for the purpose of using the different JavaScript components, for example - modals, tooltips, popovers, and so on. This needs to be before the minified Bootstrap JavaScript, if the compiled version of JavaScript is being used.

There are some components that extensively require the jQuery. Following are some of these components -

  1. For using the closable alerts
  2. For toggling the states with the help of the buttons and the checkboxes or radio buttons and using the collapse for toggling content
  3. For the purpose of carousel for slides, controls, and indicators
  4. For using Dropdowns (the Popper.js can be used for perfect positioning)
  5. For opening and closing the Modals
  6. For collapsing the Navbar
  7. For using the tooltips and popovers (the Popper.js can be used for perfect positioning)
  8. For using various other components

Downloading Bootstrap 4:

The Bootstrap 4 can be downloaded from this link given below: https://getbootstrap.com/docs/4.0/getting-started/download/.

Once the link has been opened, a window will open:

Bootstrap 4 - Environment Setup

In this window, there are two given options, one is download ready to use compiled code for Bootstrap v4.0.0 and the other option is downloading the source files that compiles Bootstrap with a person's own asset pipeline by downloading Bootstrap 4's source Sass, JavaScript, and documentation files.

Bootstrap 4 - Environment Setup

Download - By choosing this option, a user can download the pre-compiled and minified versions of Bootstrap's CSS and JavaScript. No documentation or original source code files are included. However, this does not consist of the documentation, the source files, or any other optional JavaScript dependencies such as jQuery and Popper.js.

Download Source - By choosing this option, a person can get the latest Bootstrap SCSS, JavaScript source code and documentation files. Moreover, this option also needs some additional tooling such as:

  1. Sass compiler like Libsass or Ruby Sass is supported for compiling the CSS in the website.
  2. Autoprefixer for CSS vendor prefixing.

Precompiled Bootstrap 4

Once the compiled version Bootstrap 4 is downloaded, extract the ZIP file, and you will see the following file/directory structure -

There are compiled CSS and JS (bootstrap.*), as well as compiled and minified CSS and JS (bootstrap.min.*).

Bootstrap 4 Source Code

The Bootstrap source code download includes the precompiled CSS, JavaScript, and font assets, along with source Less, JavaScript, and documentation. More specifically, it includes the following and more -

  1. The files under the js/ and scss/ are the source code responsible for Bootstrap, CSS and JavaScript.
  2. The dist/ folder consists of everything that is listed in the pre-compiled download section that is given above.
  3. The docs/examples/ only consists of the source code for Bootstrap documentation and examples of Bootstrap usage respectively.
  4. The less/ in the source code given above is basically responsible for the source code for the icon fonts in Bootstrap 4.
  5. Apart from that, the other included files provide support for other important components such as the packages, the information about the license, and anything related to development.

Creating the First Web Page with the help of Bootstrap 4:

The example given below can be used to create a very simple and easy to understand web page for Bootstrap 4 -

Example:

Test it Now

The following output will be visible, after compiling this code:

Output:

Bootstrap 4 - Environment Setup




Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA