A list of top frequently asked Bootstrap interview questions and answers are given below.
Bootstrap is a HTML, CSS, and JS framework for building the rich web applications with minimal effort. This framework emphasis more on building mobile web applications.
Bootstrap is the most popular and powerful HTML, CSS, and JavaScript front-end framework for faster and easier use, responsive layout, and mobile-first web development. It includes design templates for UI components like Forms, Buttons, Tables, Navigation, Dropdowns, Alerts, Tabs, Accordion, Carousel and many others with optional JavaScript plugins.
There are few reason why we choose Bootstrap for building websites
The key components of Bootstrap are
Class loader is a part of JRE (Java Runtime Environment) which loads Java classes into Java virtual environment. Class loaders also does the process of converting a named class into its equivalent binary form.
In Bootstrap there are two types of Layout available
Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.
Glyphicons are icon fonts which you can use in your web projects. Glyphicons Halflings are not free and require licensing, however their creator has made them available for Bootstrap projects free of cost.
Breadcrumbs are a great way to show hierarchy-based information for a site. In the case of blogs, breadcrumbs can show the dates of publishing, categories, or tags. They indicate the current page’s location within a navigational hierarchy.
A breadcrumb in Bootstrap is simply an unordered list with a class of .breadcrumb. The separator is automatically added by CSS (bootstrap.min.css) through the following class:
Bootstrap breadcrumb used for,
.breadcrumb > li + li:before {{'{'}} color: #CCCCCC; content: "/ "; padding: 0 5px; {{'}'}}
A lot of sites need a way to lay out ../images, videos,text, etc in a grid, and Bootstrap has an easy way to do this with thumbnails.
To create thumbnails using Bootstrap:
Bootstrap comes bundled with 12 jQuery plugins that extend the features and can add more interaction to your site. To get started with Bootstrap’s JavaScript plugins, you don’t need to be an advanced JavaScript developer. By utilizing Bootstrap Data API, most of the plugins can be triggered without writing a single line of code.
UI Bootstrap incorporates Bootstrap components written in AngularJS by the AngularUI team. It aims to provide AngularJS directives with the markup and CSS of Bootstrap. It has dependencies on AngularJS and Bootstrap CSS.
Kickstrap is a product where AngularJS is baked together with Bootstrap in conjunction with JavaScript Package Manager (JSPM). You can leverage the advantage of running an authenticated database-driven web application without the native backend. Kickstrap uses Firebase adhering to a Backend as a Service (BaaS) model.
There are seven styles to add a button in Bootstrap. Use the following classes to achieve the different button styles:
Bootstrap Alerts are used to provide an easy way to create predefined alert messages. Alert adds a style to your messages to make it more appealing to the users.
There are four classes that are used within <div> element for alerts.
The bootstrap pager is a form of pagination. It is used to create previous and next buttons (links).The “.pager” class is used within the <ul> element to create the previous / next buttons.
A modal is a child window that is layered over its parent window. Using a custom Jquery Plugin, Bootstrap Modal are created. To enrich user experience and to add functionality to users, modal windows are created with the help of Modal plugin.
Bootstrap container is a class which is useful and creates a centred area within the page where our site content can be put within. The advantage of the bootstrap .container is that it is responsive and will place all our other HTML code.
For more specialized layouts offsets are a useful feature. For more spacing they can be used by pushing column over.
For example, .col-xs=* classes do not support offset but they are easily replicated using an empty cell
Column ordering is one of the feature available in bootstrap and you can easily write columns in an order and show them in another one. With .col-md-push-* and .col-md-pull-*
In bootstrap, Jumbotron is generally used for content that you want to highlight like some slogan or marketing headline etc. in other words it is used to enlarge the size of the headings and to add a margin for landing page content
Bootstrap | Foundation |
---|---|
– Bootstrap offers unlimited number of UI elements | – In Foundation UI element options are very limited in numbers |
– Bootstraps uses pixels | – Foundation use REMs |
– Bootstrap encourages to design for both desktop and mobile. | – Foundation encourages to design mobile first |
– Bootstrap support LESS as its preprocessor | – Foundation support Sass and Compass as its preprocessor |
In bootstrap you can display code in two ways
The steps for creating basic or vertical forms are
A modal is a child window that is layered over its parent window. Using a custom Jquery Plugin, Bootstrap Modal are created. To enrich user experience and to add functionality to users, modal windows are created with the help of Modal plugin.
Bootstrap container is a class which is useful and creates a centred area within the page where our site content can be put within. The advantage of the bootstrap .container is that it is responsive and will place all our other HTML code.
Bootstrap collapsing elements enables you to collapse any particular element without writing any JavaScript code or the accordion markup. In Bootstrap to apply collapsing elements you have to add data-toggle= “collapse” to the controller element along with a data-target or href to automatically assign control of a collapsible element. Likewise, you can use .collapse (options), .collapse (‘show’) or .collapse (‘hide’)
List groups are components to display both simple and complex element with custom content
For example, a simple list group is created using class .list-group to address the list, and class .list-group-item to address individual item.
To add badge to list group in Bootstrap you have to simply add "badge" class within the list element.
Bootstrap offers various options for styling navigation elements all of them use the same markup and base class .nav.
The Carousel plugin is used to add a slider to your site. It is useful in condition where you want to display huge amount of contents within a small space on the web pages. Some of the standard carousel includes
Bootstrap collapsing elements enables you to collapse any particular element without writing any JavaScript code or the accordion markup. In Bootstrap to apply collapsing elements you have to add data-toggle= “collapse” to the controller element along with a data-target or href to automatically assign control of a collapsible element. Likewise, you can use .collapse (options), .collapse (‘show’) or .collapse (‘hide’)
Bootstrap is used for building websites for the following reasons,
Component | Bootstrap 3 | Bootstrap 4 |
---|---|---|
Global | ||
Source CSS Files |
LESS |
SCSS |
Primary CSS Unit |
|
|
Media Queries Unit |
|
|
Global Font Size |
|
|
Default Fonts |
Helvetica Neue, Helvetica, Arial, sans-serif |
Uses a "native font stack" (user's system fonts), with a fallback to Helvetica Neue, Arial, and sans-serif |
Grids | ||
Grid Tiers |
4 tier grid system (xs, sm, md, lg) |
5 tier grid system (xs, sm, md, lg, xl). |
Offsetting Columns |
Uses |
Uses |
Tables | ||
Dark/inverse Tables |
Not supported. |
Added dark/inverse tables with the Note: Prior to the Beta 2 release, these required the |
Table Head Styles |
Not supported. |
Added table head styles with the Note: Prior to the Beta 2 release, these required the |
Condensed Tables |
|
|
Contextual Classes |
Bootstrap 3 doesn't use the For example, Bootstrap 3 uses |
Added the |
Responsive Tables |
The |
The
Beta 2 has also introduced the |
Reflow Tables |
Not supported. |
Reflow tables have now been dropped. |
Forms | ||
Horizontal Forms |
Horizontal forms require the Forms don't require |
Bootstrap 4 dropped the Forms require either the |
Use |
Bootstrap 4 uses * Note that Bootstrap 4 initially used |
|
Checkboxes and Radio Buttons |
Uses |
Uses |
Form Control Size |
Use |
Use |
Form Label Size |
No specific classes for adjusting form label size. |
Bootstrap 4 introduced |
Help Text |
Use the |
Bootstrap 4 uses the |
Validation and Feedback Icons |
Includes validation styles for error, warning, and success states on form controls (for example, |
Validation styles are not available for Bootstrap 4 forms. Use custom Bootstrap form validation messages instead. |
Legends |
No classes for styling the form legends. |
Provides the option of using |
Static text |
Uses |
In Bootstrap 4, |
Custom Forms |
Not supported. |
Bootstrap 4 introduced custom forms — completely custom form elements that replace the browser defaults. |
Buttons | ||
Styles |
Includes the The |
Introduced the Dropped the Note that the |
Outline Buttons |
Not supported. |
Introduced the
(The |
Button Sizes |
The |
Dropped the |
Input groups | ||
Classes |
Bootstrap 3 uses the |
Bootstrap 4 dropped Bootstrap 4 also introduced |
../images | ||
Responsive ../images |
Use |
Use |
Image Alignment |
Use |
Uses Can also use the various Can use the various |
Media Objects | ||
Classes |
Includes many different classes for media objects, including |
Uses just |
Dropdowns | ||
Structure |
Apply dropdowns to lists (i.e. using |
Dropdowns can be built with Apply the |
Menu Headers |
Apply |
Apply |
Dividers |
Apply the |
Apply the |
Disabled Menu Items |
Apply the |
Apply the |
Button Groups | ||
Justified? |
Supports justified button groups (via the |
Not supported. |
Extra Small? |
Supports extra small button groups (via the |
Not supported (dropped the |
Navs | ||
Inline Navs |
There is no |
Can use the |
Navbars | ||
Colors |
Limited (preset) color options. Supports inverse navbars but not the other classes. |
New (preset) color options. Introduced the |
Navbar Alignment |
Use |
Can either use spacing utilities such as |
Navbar Forms |
Add the |
Bootstrap 4 dropped the |
Fixed Navbars |
Uses |
Uses |
Pagination | ||
Default Pagination |
Only requires |
Must also add |
Pagers |
Uses |
Pagers have been dropped in Bootstrap 4 (Alpha 3).
|
Labels | ||
Pill Labels |
The |
Labels have been replaced by badges in Bootstrap 4. Badges can use the |
Tags | ||
Supported? |
No. "Tags" are called "Labels" in Bootstrap 3 (i.e. they use the |
Tags have now been renamed to "badges". These replace labels from Bootstrap 3. |
Jumbotron | ||
Full-Width |
The |
Introduced the |
Progress Bars | ||
Uses progress ?
|
Doesn't use the |
Using the |
Glyphicons | ||
Supported? |
Supported. |
Not supported. |
Typography | ||
Blockquotes |
Bootstrap styles are applied to the |
Introduced the |
Blockquote Alignment |
Use |
Use the text utilities to align blockquotes ( |
Page Headers |
The |
The |
Description Lists |
The |
Horizontal lists are now declared with the |
Non-Responsive Usage | ||
Supported? |
Supported. You can specify a layout to be non-responsive. |
Not supported. |
List Groups | ||
Linked List Items / Button List Items |
Apply |
Apply |
Collapse | ||
Show content |
Uses |
Uses |
Cards | ||
Supported? |
Not supported. |
Introduced in Bootstrap 4. Cards replace functionality that was previously provided by panels, wells, and thumbnails. |
Panels | ||
Supported? |
Supported. |
Not supported. Use cards instead. |
Wells | ||
Supported? |
Supported. |
Not supported. Use cards instead. |
Thumbnails | ||
Supported? |
Supported. |
Not supported. Use cards instead. |
Breadcrumbs | ||
Classes |
Uses the |
Also requires Breadcrumbs can also be used outside of lists. For example, the |
Carousels | ||
Carousel Item |
Use |
Use |
Affix | ||
Supported? |
Yes. |
No. |