Bootstrap raster analysis
Container
-
Center: A container with the class name .container. The width of the center has different values on each screen device. The width of the center is different on both sides of the center. Just leave it blank.
The width of the center of each size is as follows:Screen equipment The width of the center of the page max-width:768px xs inherits the width of the parent element (i.e. width: 100%) min-width:768px sm 750px min-width:992px #md 970px min-width:1200px lg 1170px
.container { padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; }@media (min-width: 768px) { .container { width: 750px; }} @media (min-width: 992px) { .container { width: 970px; }} @media (min-width: 1200px) { .container { width: 1170px; }} .container-fluid { padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; }
No matter what the width of the screen is, the container.container will always have a padding of 15px on the left and right to prevent the content from sticking directly to the edge of the browser. Never nest another container in a container.
.container-fluid's layout container is the same as the layout container smaller than 768px screen. It does not set a fixed width value and inherits it. The width of the parent element.
.container container is used to provide width constraints on responsive width. In response to changes in size, the container is actually changed. Rows and columns are based on percentages, so they do not need to make any changes.
Row (row)
Row: A container with class name .row; it is column (col) There is a total of space and it is divided into 12 columns.
There will be two negative 15px margin values at both ends of the row, in order to offset the padding values on both sides of the container. .row is invalid when used outside the container.
.row { margin-right: -15px; margin-left: -15px; }
Column
Each column has 15px padding on both sides value. Never use col outside a .row container, otherwise col will be invalid.
The padding value of each column col provides a blank space for its content so that the content will not stick to the edge of the browser and the columns will not stick together.
==Columns are allocated according to percentages (relative to the percentage of the center width, so the wider the center, the greater the width of each column)==.
//五列的宽度 .col-xs-5 { width: 41.66666667%; }// 四列的宽度 .col-xs-4 { width: 33.33333333%; }// 三列的宽度 .col-xs-3 { width: 25%; }// 占两列的宽度 .col-xs-2 { width: 16.66666667%; }// 每列的宽度是版心宽度的8.33333333% .col-xs-1 { width: 8.33333333%; }... // 如果是中等屏幕 类名为.col-md-1 // 小屏幕 类名为:.col-sm-1 // 大屏幕 类名为:.col-lg-1 @media (min-width:768px) { .col-sm-1 { width: 8.33333333%; } .col-sm-2 { width: 16.66666667%; } ... } @media (min-width: 992px) { .col-md-1 { width: 8.33333333%; } .col-md-2 { width: 16.66666667%; } ... } @media (min-width:1200px) { .col-lg-1 { width: 8.33333333%; } .col-lg-2 { width: 16.66666667%; } ... }
栅格嵌套
After setting container/row/column, you can create a new grid in the column In the grid system, just add rows directly to the column. There is no need to add a container, because the padding values on both sides of the column can offset the negative margin values on both sides of the row, and the column is equivalent to a container.
Offsets
Offset offset is mainly the margin of the column -left value determines. If it is offset by one column, it is margin-left:8.3333333% (1/12). If it is offset by two columns, it is margin-left:16.66666667% (that is, 2/12);
.col-xs-offset-0 { margin-left: 0; }.col-xs-offset-1 { margin-left: 8.33333333%; }... @median (min-width:768px) { .col-sm-offset-0 { margin-left: 0; } .col-sm-offset-1 { margin-left: 8.33333333%; } ... } ...
Column sorting (Push and Pull)
In practical applications, it is more about calling position and sorting, allowing you to break the html p Fixed layout from top to bottom and left to right.
pull and push are implemented through the right and left values of position. Pull is implemented through the right value. The pull-1 value right:8.33333333% (1/12); push-1 value => left:8.33333333%(1/12);
// push 距离左边的距离(向右推的列数)以最小屏为例 .col-xs-push-2 { left: 16.66666667%; }.col-xs-push-1 { left: 8.33333333%; }.col-xs-push-0 { left: auto; }... // pull 距离右边的距离(向左拉的列数)以最小屏为例 .col-xs-pull-2 { right: 16.66666667%; }.col-xs-pull-1 { right: 8.33333333%; }.col-xs-pull-0 { right: auto; }
The above is the detailed content of Bootstrap raster analysis. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to use Bootstrap to get the value of the search bar: Determines the ID or name of the search bar. Use JavaScript to get DOM elements. Gets the value of the element. Perform the required actions.

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

Use Bootstrap to implement vertical centering: flexbox method: Use the d-flex, justify-content-center, and align-items-center classes to place elements in the flexbox container. align-items-center class method: For browsers that do not support flexbox, use the align-items-center class, provided that the parent element has a defined height.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.
