Home > Web Front-end > Bootstrap Tutorial > How to write bootstrap five column layout

How to write bootstrap five column layout

Release: 2019-07-31 09:00:30
Original
2431 people have browsed it

How to write bootstrap five column layout

We know that when using Bootstrap grid, we can easily divide the web page into modules. Bootstrap includes a responsive, mobile-first, fluid grid system that scales up to 12 columns appropriately as the device or viewport size increases.

It contains predefined classes for simple layout options, as well as powerful mixin classes for generating more semantic layouts. If we want to divide it into 2 equal parts, use col-md-6; if we want to divide it into 3 equal parts, use col-md-4; but what if we want to divide it into 5 or 8 equal parts? The following example is the fifth-level distribution layout of bootstrap:

<!DOCTYPE html>
<html>
 
    <head>
        <meta charset="UTF-8">
        <!--视口的设置,让网页能等比例的缩放到对应设备中-->
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <!--告诉ie浏览器用最新内核去渲染网页-->
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Document</title>
        <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
 
        <style type="text/css">
            .col-xs-1-5,
            .col-sm-1-5,
            .col-md-1-5,
            .col-lg-1-5 {
                position: relative;
                min-height: 1px;
                padding-right: 10px;
                padding-left: 10px;
            }
            
            .col-xs-1-5 {
                width: 20%;
                float: left;
            }
            
            @media (min-width: 768px) {
                .col-sm-1-5 {
                    width: 20%;
                    float: left;
                }
            }
            
            @media (min-width: 992px) {
                .col-md-1-5 {
                    width: 20%;
                    float: left;
                }
            }
            
            @media (min-width: 1200px) {
                .col-lg-1-5 {
                    width: 20%;
                    float: left;
                }
            }
        </style>
 
        <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
        <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
 
        <body>
 
            <div>
                <div>
                    <div>
                        <div class="items text-center">
                            <img src="../img/my.jpg" />
 
                            <div>
                                <div id="">姓名:<span>王婷</span></div>
                            </div>
 
                            <div>
                                <div id="">性别:<span>女</span></div>
                            </div>
 
                            <div>
                                <div id="">部门:<span>宣传部</span></div>
                            </div>
                        </div>
                    </div>
                    <div>
                        <div class="items text-center">
                            <img src="../img/my.jpg" />
 
                            <div>
                                <div id="">姓名:<span>王婷</span></div>
                            </div>
 
                            <div>
                                <div id="">性别:<span>女</span></div>
                            </div>
 
                            <div>
                                <div id="">部门:<span>宣传部</span></div>
                            </div>
                        </div>
                    </div>
                    <div>
                        <div class="items text-center">
                            <img src="../img/my.jpg" />
 
                            <div>
                                <div id="">姓名:<span>王婷</span></div>
                            </div>
 
                            <div>
                                <div id="">性别:<span>女</span></div>
                            </div>
 
                            <div>
                                <div id="">部门:<span>宣传部</span></div>
                            </div>
                        </div>
                    </div>
                    <div>
                        <div class="items text-center">
                            <img src="../img/my.jpg" />
 
                            <div>
                                <div id="">姓名:<span>王婷</span></div>
                            </div>
 
                            <div>
                                <div id="">性别:<span>女</span></div>
                            </div>
 
                            <div>
                                <div id="">部门:<span>宣传部</span></div>
                            </div>
                        </div>
                    </div>
 
                    <div>
                        <div class="items text-center">
                            <img src="../img/my.jpg" />
 
                            <div>
                                <div id="">姓名:<span>王婷</span></div>
                            </div>
 
                            <div>
                                <div id="">性别:<span>女</span></div>
                            </div>
 
                            <div>
                                <div id="">部门:<span>宣传部</span></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </body>
 
</html>
Copy after login

Recommended: bootstrap introductory tutorial

The above is the detailed content of How to write bootstrap five column layout. For more information, please follow other related articles on the PHP Chinese website!

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