BootstrapVueprovides several convenient functional components tailored for layout, which can simplify your complex page markup compared to traditional Bootstrap v4 markup. Feel free to switch back and forth between traditional Bootstrap v4 markup (i.e. s and classes) and BootstrapVue's convenient functional layout components.
Bootstrap's grid system uses a series of containers, rows, and columns to layout and align content. It's built with flexbox and is fully responsive. Below is an example and an in-depth look at how the grid comes together.
The above example creates three equal-width columns on small, medium, large, and extra large devices using Bootstrap v4's predefined grid classes. Those columns are centered in the page with the parent .container.
Containers () are the most basic layout element in Bootstrap. Choose from a responsive, fixed-width container (meaning its max-width changes at each breakpoint) by default, or fluid-width (meaning it's 100% wide all the time) by setting 'fluid' prop, or responsive containers where the container is fluid up until a specific breakpoint (requires Bootstrap CSS v4.4+).
Responsive containers are new in Bootstrap v4.4. They allow you to specify a container that is 100% wide (fluid) until particular breakpoint is reached at which point a max-width is applied. For example, setting prop fluid to 'md' will render a container that is 100% wide to start until the 'md' breakpoint is reached, at which point it will become a standard non-fluid container.
Rows are wrappers for columns. Each column has horizontal padding (called a gutter) for controlling the space between them. This padding is then counteracted on the rows with negative margins. This way, all the content in your columns is visually aligned down the left side.
While Bootstrap uses em or rem units for defining most sizes, pxs are used for grid breakpoints and container widths. This is because the viewport width is in pixels and does not change with the font size.
For example, here are two grid layouts that apply to every device and viewport, from xs to xl. Add any number of unit-less classes for each breakpoint you need and every column will be the same width.
Create equal-width columns that span multiple lines by inserting a .w-100 where you want the columns to break to a new line. Make the breaks responsive by mixing .w-100 with some responsive display utilities.
There was a Safari flexbox bug that prevented this from working without an explicit flex-basis or border. There are workarounds for older browser versions, but they shouldn't be necessary if your target browsers don't fall into the buggy versions.
Auto-layout for flexbox grid columns also means you can set the width of one column and have the sibling columns automatically resize around it. You may use predefined grid classes (as shown below), grid mixins, or inline widths. Note that the other columns will resize no matter the width of the center column.
Bootstrap's grid includes five tiers of predefined classes for building complex responsive layouts. Customize the size of your columns on extra small, small, medium, large, or extra large devices however you see fit.
For grids that are the same from the smallest of devices to the largest, use the col and cols="*" props. Specify a number of cols when you need a particularly sized column; otherwise, feel free to stick to col (which is applied automatically if no cols are specified).
Using a single set of sm="*" or sm (boolean for equal width @sm) props, you can create a basic grid system that starts out stacked on extra small devices before becoming horizontal on desktop (medium) devices.
Use order-* props for controlling the visual order of your content. These props are responsive, so you can set the order by breakpoint (e.g., order="1" order-md="2"). Includes support for 1 through 12 across all five grid tiers. defaults to an order value of 0.
You can offset grid columns in two ways: our responsive offset-* props or the margin utility classes. Grid offset-* props are sized to match columns while margins utility classes are more useful for quick layouts where the width of the offset is variable.
To nest your content with the default grid, add a new and set of components within an existing component. Nested rows should include a set of columns that add up to 12 or fewer (it is not required that you use all 12 available columns).
Use the responsive cols-* props in to quickly set the number of columns that best render your content and layout. Whereas normal column widths are apply to the individual columns (e.g., ), the row columns col-* props are set on the parent as a shortcut.
Use these row columns to quickly create basic grid layouts or to control your card layouts. The default maximum number of row columns in Bootstrap v4.4 is 6 (unlike the regular columns which have a default maximum of 12 columns)
Use the margin and padding spacing utilities to control how elements and components are spaced and sized. Bootstrap 4 includes a five-level scale for spacing utilities, based on a 1rem value default SASS $spacer variable. Choose values for all viewports (e.g., .mr-3 for margin-right: 1rem), or pick responsive variants to target specific viewports (e.g., .mr-md-3 for margin-right: 1rem starting at the md breakpoint).
3a8082e126