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

WBOY
Release: 2016-06-24 12:05:06
Original
1183 people have browsed it

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.

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template