The BootStrap grid system can divide our container into several equal parts. If we want to leave a certain amount of space between each part, the first method we may think of is to use [See an example]: CSS style: .row div { height: 100px; } HTML code: <div class="container"> <!-- Row element --> <div class="row"> <!-- Column element col-xs-value col-sm-value col-md-value col-lg-value --> <div class="col-lg-5" style="background-color: wheat;"></div> <div class="col-lg-4" style="background-color: pink;"></div> <div class="col-lg-3" style="background-color: black;"></div> </div> </div> [The original effect is as follows]:Now we want to create a gap between these three parts (10px), but we cannot change the original layout. Here we add a margin value: The css style is changed to: .row div { height: 100px; margin-right:10px; } 【Effect after adding margin value】: It was observed that one part was squeezed down, which means that this wave of operations changed the original grid layout. The reasons are as follows: When we divide the grid, each part is full and squeezed together. To create a blank space between each column, you add a Through the above operations and explanations, we know that it is not possible to achieve the effect of leaving gaps in the grid system by setting 【Solution】: We can set a CSS style: .row div { padding-left: 0px; // remove the default left padding padding-right: 10px; height: 100px; } .hezi { width: 100%; background-color: green; } HTML code: <div class="container"> <!-- Row element --> <div class="row"> <!-- Part 1 --> <div class="col-md-5" style="background-color: ;"> <div class="hezi"></div> </div> <!-- Part 2 --> <div class="col-md-4" style="background-color: ;"> <div class="hezi"></div> </div> <!-- Part 3 --> <div class="col-md-3" style="background-color: ;"> <div class="hezi"></div> </div> </div> </div> Note: BootStrap's grid system is very convenient for responsive web development. When using the grid system, you can easily use row and col to control the layout. However, col- - The final effect and analysis are as follows: SummarizeThis is the end of this article about the solution to leaving gaps between BootStrap grids. For more information about leaving gaps between BootStrap grids, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of mysql MGR single-master and multi-master mode switching knowledge points
Table of contents Overview Solution 1: Closures S...
Introduction Use simple jQuery+CSS to create a cus...
3 ways to implement tab switching in Vue 1. v-sho...
Preface In the development process, defining vari...
Table of contents Zabbix monitors Nginx Zabbix mo...
We are all familiar with the tr command, which ca...
Table of contents How to deploy MySQL service usi...
Table of contents Difference between char and var...
1. Install tomcat8 with docker 1. Find the tomcat...
This article shares the specific code of JavaScri...
HTML provides five space entities with different ...
MySQL 5.7.8 introduced the json field. This type ...
(?i) means do not match case. Replace all uppercas...
Preface The logical judgment statements we use in...
Purpose Understand the Nginx ngx_http_limit_conn_...