Here in this article, we will be listing frequently asked Bootstrap 4 Interview Questions and Answers with the belief that they will be helpful for you to gain higher marks. Also, to let you know that this article has been written under the guidance of industry professionals and covered all the current competencies.
Bootstrap 4 is the current version of Bootstrap. Bootstrap 4 is basically an HTML, JavaScript and CSS framework. Bootstrap 4 is popular among the developer across the globe for building mobile-first and also responsive sites with a Bootstrap content distribution network and the template starter page. Bootstrap 4 is free to download and use.
The alpha 1 version of the Bootstrap 4 got released on 19th of August 2015, and the beta 1 version of the Bootstrap 4 got released on 10th of August 2017
S.no | Bootstrap 3 | Bootstrap 4 |
---|---|---|
1. | It has 4 grid system | It has 5 grid system |
2. | The offset class of Bootstrap 3 is (col-md-offset-4). | The offset class of Bootstrap 4 is (offset-md-4). |
3. | In Bootstrap 3, this (.img-responsive) class is used for responsive image. | In Bootstrap 4, this (.img-fluid) class is used for responsive image. |
4. | In Bootstrap 3 (.input-lg) and (.input-sm) is used to increase or decrease the input size. | In Bootstrap 4 (.form-control-lg) and (.form-control-sm) is used to increase or decrease the input size. |
This is a primary bootstrap 4 interview question.
The Bootstrap 4 grid System is developed with flexbox has a limit of 12 columns across the entire page. If a developer does not want to use the 12 columns individually then, it can be merged to create a full column. The grid system in Bootstrap 4 is responsive and also depending upon the screen size the columns are re-arranged dynamically. The UI developer has to make sure that the sum must be 12 or less than 12.
The above classes can be united to create a flexible and dynamic layout.
Basic Structure:-
<!-- Control the width of the column, and how they should look on different devices -->
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<!-- Or let Bootstrap automatically manages the layout -->
<div class="row">
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
</div>
Point to be noted: Go through this Q&A very thoroughly as this is one of the essential bootstrap 4 interview questions.
Rounded Corners:-
The class .rounded add round corners to the image .
syntax:-
<img alt="Statue of unity" class="rounded" src="Statueofunity.jpg">
Circle :-
The class .rounded-circle turns the shape of the image to a circle.
Syntax:-
<img alt="Statue of unity" class="rounded-circle" src="Statueofunity.jpg">
Thumbnail:-
The class .img-thumbnail turns the shape of the image to a thumbnail, i.e. bordered image.
Syntax:-
<img alt="Statue of unity" class="img-thumbnail" src="Statueofunity.jpg">
Aligning Images:-
An image is aligned to the left with the class .float-left and an image is aligned to the right with the class .float-right
Syntax:-
<img class="float-left" src="Statueofunity .jpg">
<img class="float-right" src="Statueofunity .jpg">
Centered Image:-
The classes .mx-auto (margin:auto) & .d-block (display:block) align the image at the center.
Syntax:-
<img class="mx-auto d-block" src="Statueofunity .jpg">
Responsive Images:-
The responsive images adjust themselves dynamically according to the size of the screen. The class .img-fluid is added to the <img> tag to create a responsive images. The class .img-fluid gives max-width: 100%; & height: auto; to the image that has to be responsive.
Syntax:-
<img alt="Pune" class="img-fluid" src="img_Pune.jpg">
A Bootstrap 4 table has very light padding and has a horizontal divider. The class .table gives primary styling to a table.
1 .table-primary—it is blue in color, and it shows a significant action.
2 .table-success-it is green in color, and it shows a successful or a positive action
3 .table-warning -it is orange in color and it shows a warning and needs attention.
This is one of the most asked Bootstrap 4 interview questions.
Bootstrap 4 Positions rapidly configure the position of the elements. The positioning classes are .position-static, .position-relative, .position-absolute, .position-fixed, .position-sticky.
Text Colours:-
Bootstrap 4 has few contextual classes which can be used to give "meaning through colours". The classes for the text colours are: .text-muted, .text-success, .text-info, .text-primary, .text-danger, .text-secondary, .text-dark, .text-white, .text-body (default body colour/often black) and .text-light. Contextual classes can be used on links, and this will add a darker hover color. 50% opacity for black or white text can be added with the classes .text-black-50 or .text-white-50.
Background Colours:-
The background colours classes are .bg-primary, .bg-warning, .bg-info, .bg-success, .bg-danger, .bg-secondary, .bg-dark & .bg-light. Since the background colours do not set the colour of the text therefore the developer have to use them with the class .text-*
Bootstrap 4 gives an effortless way to align the images and the videos along with the content. We can use media objects to show tweets, comments on blogs and many more things. To have a media object the container needs to have a class named .media and for the content of the media, a child container needs to be created with a class attached .media-body
To make sure sufficient spacing is given used padding and other tags as needed. We can have more than one media objects nested with each other. You can add another .media class in a container with a class of .media-body. Alignment to the right can be done by adding an image after .media-body container. For Bottom, top or middle alignment we can provide utilities of flex such as align-self*