InterviewSolution
Saved Bookmarks
| 1. |
Types of Layouts in Bootstrap? |
|
Answer» Bootstrap has different layouts to adjust with wide range of devices such as desktops, TABLETS, mobile. Let us see what all layouts are PART of Bootstrap:
Use the container element when you want fixed-width which is responsive. Include it like this: <!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Demo</title> <meta charset="utf-8"> <meta name="VIEWPORT" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"> <script SRC="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h1>Demo Page</h1> <p>The .container class PROVIDES a fixed width container.</p> </div> </body> </html>
Use the container-fluid element to provide a full width container that spans the entire width of the viewport: Include it like this: <!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Demo</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script> </head> <body> <div class="container-fluid"> <h1>Demo Page</h1> <p>The .container-fluid class provides a full width container, spanning the entire width of the viewport.</p> </div> </body> </html>The following describes the difference between both the layouts: |
|