Bootstrap documentation provides sample code for various types of navbars<\/a>. You can copy\/paste this code into your own project. That documentation page can be rather confusing when you first look at it. <\/p>\n\n\n\nStep 3: Creating containers in Bootstrap<\/h3>\n\n\n\n In this step, we will go over the initial step in defining a layout in Bootstrap: setting up a container for the grid. Containers, as the name suggest, contain the grid that controls the layout of the content. In other words, containers also contain the content. . A web page may have one containers or multiple containers. Containers can be nested, but in most cases you don’t use nested containers.<\/p>\n\n\n\n
How do you define a container in Bootstrap? <\/strong>Remember that Bootstrap is a set of CSS code. So, it comes with a .container class. You add this .container class to an HTML element in the body of the HTML page. Most often, you will add the .container class to an HTML element such as main, section, article, or div. <\/p>\n\n\n\nBy default, the .container class comes with padding that provides an attractive left and right margin. That makes the content look centered on the web page without you needing to do anything else.<\/p>\n\n\n\n
In some cases, you will the content to stretch all the way across a page without any margin. This is most common when using an image that you want to fully span the width of the page. You implement this style by using the class .container-fluid instead of .container. <\/p>\n\n\n\n
Terms<\/strong>. Be sure to understand the following three terms when working with grid layouts.<\/p>\n\n\n\nViewport<\/strong>: the part of the web page that is visible<\/strong> within the browser. The viewport is only what you see at a particular time. The viewport does not include the entire web page if you have to scroll to see the rest of the web page. The browser automatically knows what parts of the page is visible on the screen. This information, known as the viewport, is very useful in developing web pages, particularly when you add interactions or behaviors that you only want to start activating when a person scrolls into a certain area of the page.<\/p>\n\n\n\nIn terms of layout and responsive design, the viewport keeps track of the width of the visible page within the browser. <\/p>\n\n\n\n
Breakpoints<\/strong>: A breakpoint is a specified width of the viewport, e.g., 960px. When the browser is adjusted to go beyond or below that width, i.e., breakpoint, the design can respond with a change of layout to accommodate the smaller or larger width. This is where responsive design comes into play. <\/p>\n\n\n\nMin-width<\/strong>: the viewport width in pixels at which <\/p>\n\n\n\nBootstrap sets sizes for the following widths as max-width and breakpoints:<\/p>\n\n\n\nSmall<\/strong> \u2265 576px<\/td>Medium<\/strong> \u2265 768px<\/td>Large<\/strong> \u2265 992px<\/td>Extra Large<\/strong> \u2265 1200px<\/td><\/tr><\/tbody><\/table>Min-width breakpoints: top row <\/figcaption><\/figure>\n\n\n\nWhen use the class .container, the width of the container changes depending upon the width of the viewport. While this may seem confusing at first, this feature allows you to specify in your CSS different layouts for different widths. Obviously, phones have viewports with smaller widths than laptop and desktop computers. That’s where having your content in a container that can automatically adjust based on the viewport width is really helpful.<\/p>\n\n\n\n
Creating Grids in Bootstrap<\/h3>\n\n\n\n Always keep in mind that Bootstrap is a set of predefined CSS classes that you can use in your HTML. Bootstrap allows you to easily define a grid that is 12 columns wide. And you can add as many or as few rows as you need. <\/p>\n\n\n\n
To define a grid, start with the container. Then you define the number of columns, and then a row.<\/p>\n\n\n\n
<main class=\"container\">\n<section class=\"col-10 offset-1\">\n<div class=\"row\">\n<h1>This is a heading<\/h1>\n<p>This is a paragraph of text<\/p>\n<\/div>\n<\/section>\n<\/main><\/code><\/pre>\n\n\n\nThe code above shows a simple Bootstrap grid that is 10 columns wide, and that is offset by 1 column on the left margin. The offset provides extra margin. <\/p>\n\n\n\n
<\/p>\n\n\n\n
<\/p>\n","protected":false},"excerpt":{"rendered":"
Using Bootstrap The current version of Bootstrap is 4.5; new versions come out regularly. When you’re looking at documentation on the web to figure out how to do something in Bootstrap, be sure to note the version number. Version 4 is very different from version 3. So, a lot of older advice about Bootstrap can […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[38],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts\/2356"}],"collection":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/comments?post=2356"}],"version-history":[{"count":35,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts\/2356\/revisions"}],"predecessor-version":[{"id":2410,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts\/2356\/revisions\/2410"}],"wp:attachment":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/media?parent=2356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/categories?post=2356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/tags?post=2356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}