Home Web Front-end HTML Tutorial 【7】Understand the basic case of Bootstrap grid system (2)_html/css_WEB-ITnose

【7】Understand the basic case of Bootstrap grid system (2)_html/css_WEB-ITnose

Jun 24, 2016 pm 12:05 PM
bootstrap Base grid Case system

ps. What I want to say this time is "Responsive column resets", but I don’t know why the Chinese official website does not provide a translation, but when I saw the case, I felt like this It's like a bug. Let me call this a high-level bug for my own convenience. If you have other good opinions, please tell me.

============================================== ================================================== ===

Responsive column resets means that at certain thresholds, some columns may appear higher than others. This situation may not be what you want. It is recommended to use a combination of .clearfix (clearing floats) and the responsive tool classe.

I won’t talk about cleaning the floats. Anyone with a certain foundation should know it. As for responsive tools Classe will talk about it later (you can go to the Chinese official website to see it), but here is to let everyone know that there is such a highly buggy situation.

============================================== ================================================== ===

Post the code directly

<!DOCTYPE html><html lang="zh-cn"><head>    <meta charset="utf-8">    <!-- Bootstrap不支持IE的兼容模式,加入此标签以确保在每个被支持的IE浏览器中保持最好的页面展现效果 -->    <meta http-equiv="X-UA-Compatible" content="IE=edge">    <!-- 由于Bootstrap 3是移动设备优先,加入此标签是为了确保适当的绘制和触屏缩放 -->    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <title>Bootstrap-Template-04</title>    <!-- 最新 Bootstrap 核心 CSS 文件 -->    <link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap.min.css">    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->    <!--[if lt IE 9]>        <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.min.js"></script>        <script src="http://cdn.bootcss.com/respond.js/1.3.0/respond.min.js"></script>    <![endif]-->    <style>.show-grid { margin-top: 15px; }.show-grid [class^="col-"] {  padding-top: 10px;  padding-bottom: 10px;  background-color: #eee;  border: 1px solid #ddd;}    </style></head><body><div class="container"><h1>Responsive column resets<small>我自己叫这个是高度bug</small></h1><div class="row show-grid">  <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3<br>内容要多多---内容要多多---内容要多多---内容要多多---内容要多多---内容要多多</div>  <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>  <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>  <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div></div></div>    <!-- 所有 Bootstrap 插件都依赖 jQuery,因此jQuery必须在Bootstrap之前引入 -->    <script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->    <script src="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script></body></html>
Copy after login

Let’s first take a look at the renderings of this under the large screen sm plan (the sm plan is 3 3 3 3 =12, exactly one line)

From this picture, we can see at a glance that there is too much content at the front, which increases the height. What is the effect under the xs scheme (xs scheme is 6 6= 12 rows, 2 rows in total)

The first effect:

The second effect

Through compression In the browser, we saw 2 effects, but neither one is the effect we want. At this time, do you feel that there is a bug? I think so. The official website provides a solution (use .clearfix (cleanup) Floating) and a combination of responsive tool classes)

Let’s take a look at the modified code (I only post the main parts)

<div class="row show-grid">  <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3<br>内容要多多---内容要多多---内容要多多---内容要多多---内容要多多---内容要多多</div>  <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>  <!-- 在某些阈值时,某些列可能会出现比别的列高的情况。这个情况可能不是你所要的,建议使用.clearfix(清理浮动)和响应式工具classe的组合 -->  <div class="clearfix visible-xs"></div>  <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>  <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div></div>
Copy after login

Now let’s take a look at the effect

This is exactly what the xs plan looks like, haha.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to get the bootstrap search bar How to get the bootstrap search bar Apr 07, 2025 pm 03:33 PM

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.

How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

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.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

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 do vertical centering of bootstrap How to do vertical centering of bootstrap Apr 07, 2025 pm 03:21 PM

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.

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

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-

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

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.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

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.

What to do if the Bootstrap Table uses AJAX to get data garbled What to do if the Bootstrap Table uses AJAX to get data garbled Apr 07, 2025 am 11:54 AM

Solutions to the garbled code of Bootstrap Table when using AJAX to obtain data from the server: 1. Set the correct character encoding of the server-side code (such as UTF-8). 2. Set the request header in the AJAX request and specify the accepted character encoding (Accept-Charset). 3. Use the "unescape" converter of the Bootstrap Table to decode the escaped HTML entity into original characters.

See all articles