bootstrap

Bootstrap是一个易用、优雅、灵活、可扩展的前端工具包,里面包含了丰富的Web组件,包括布局、栅格、表格、表单、导航、按钮、进度条、媒体对象等,基于这些组件,可以快速搭建一个漂亮、功能完备的网站。由于Firefox、Chrome、Safari等主流浏览器对W3C标准有着较好的支持,因此,Bootstrap在网页夸浏览器兼容方面也有相当不错的表现。

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="./css/bootstrap.min.css"/>
    <style>
        .tb_row>div{
            border: 1px solid red;
            height: 100px;
        }
    </style>
</head>
<body>
<!--container固定布局;container-fluid:流动布局-->
<div class="container">
    <div class="row tb_row">
        <div class="col-lg col-sm  col-md col-xl">1</div>
        <div class="col-md col-lg col-sm col-xl">2</div>
        <div class="col-lg col-md col-sm col-xl">3</div>
        <div class="col-md col-lg col-sm col-xl">4</div>
        <div class="col-md col-sm col-lg col-xl">5</div>
        <div class="col-lg col-md col-sm col-xl">6</div>
        <div class="col-lg col-md col-sm col-xl">7</div>
        <div class="col-lg col-md col-sm col-xl">8</div>
        <div class="col-md col-lg col-sm col-xl">9</div>
        <div class="col-lg col-md col-sm col-xl">10</div>
        <div class="col-lg col-md col-sm col-xl">11</div>
        <div class="col-lg col-md col-sm col-xl">12</div>
        <!--<div class="col-lg col-md col-sm col-xl">13</div>--><!--超过12个会折行-->
    </div>
    <div class="row tb_row">
        <div class="col-sm-1 col-lg-2 col-md-3 col-xl-1">a</div>
        <div  class="col-sm-4 col-lg-4 col-md-1 col-xl-1">s</div>
        <div  class="col-sm-6 col-lg-3 col-md-1 col-xl-1">d</div>
       <!-- 屏幕分辨率不同时的比例调整-->
    </div>
    <div class="row tb_row">
        <div class="col-sm-auto">z111111111111111</div>
        <div class="col-sm-2">x</div>
        <div class="col-sm-3">c</div>
        <!--col-..-auto按内容自动分配-->
    </div>
    <div class="row tb_row">
        <div class="col-md-4 offset-2"></div>
        <div class="col-md-6"></div>
        <div class="col-md-2"></div>
        <!--设置margin-left 8.333%-->
    </div>
    <div class="row tb_row">
        <div class="col-md-2 offset-lg-3"></div>
        <div class="col-md-5"></div>
        <div class="col-md-1"></div>
       <!-- 设置不同屏幕的margin-left-->
    </div>
    <div class="row tb_row">
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
       <!-- 均等分配-->
    </div>
    <div class="row tb_row">
        <div class=" pt-1 col"></div><!--margin-top设为4px,0.25em-->
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
    </div>
    <div class="row tb_row">
        <div class=" py-1 col"></div><!--margin-top和margin-bottom设为4px,0.25em-->
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
    </div>
    <div class="row tb_row">
        <div class=" w-75 col"></div><!--w-75为75% w-100为100% -->
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
    </div>
    <div class="row tb_row">
        <div class=" h-120 col"></div><!-- h-100为100% 120就会撑开-->
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
        <div class="col"></div>
    </div>
    <div class="row align-content-center" style="height: 300px;border: 1px solid red">
        <div class="col-lg-1" style="height: 60px;border: 1px solid black"></div>
        <div class="w-100"></div><!--折行-->
        <div class="col-lg-1" style="height: 60px;border: 1px solid black"></div>
        <div class="w-100"></div>
        <div class="col-lg-1" style="height: 60px;border: 1px solid black"></div>
       <!-- align-content-center考虑多行,y轴居中-->
       <!-- align-items-center  相对父容器垂直居中
        align-items-start 相对父容器顶部对齐
        align-items-end  相对父容器底部对齐-->
    </div>
    <div class="row " style="height: 300px;border: 1px solid red">
        <div class="col-lg-1 align-self-center" style="height: 60px;border: 1px solid black"></div>
        <div class="col-lg-1 align-self-end" style="height: 60px;border: 1px solid black"></div>
        <div class="col-lg-1 " style="height: 60px;border: 1px solid black"></div>
        <!-- align-self-center y轴居中 align-self-end y轴末端 align-self-start y轴顶部-->
       <!-- align-self-center  自身在flexbox中的y轴分布-->
    </div>
    <div class="row align-items-center " style="height: 300px;border: 1px solid red">
        <div class="col-lg-1 " style="height: 60px;border: 1px solid black"></div>
        <div class="col-lg-1 " style="height: 60px;border: 1px solid black"></div>
        <div class="col-lg-1 " style="height: 60px;border: 1px solid black"></div>
        <!-- align-items-center  相对父容器垂直居中-->
    </div>
    <div class="row justify-content-center" style="height: 300px;border: 1px solid red">
        <div class="col-lg-1 " style="height: 60px;border: 1px solid black"></div>
        <div class="col-lg-1 " style="height: 60px;border: 1px solid black"></div>
        <div class="col-lg-1 " style="height: 60px;border: 1px solid black"></div>
        <!-- justify-content-center 子元素水平居中-->
    </div>



</div>

</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值