bootstrap框架之栅格布局

本文介绍了Bootstrap框架中的栅格布局,包括.container和.container-fluid两类容器的特点及使用方法,并提供了bootlint工具的使用介绍以帮助检查CSS样式的正确性。

bootstrap框架之栅格布局

1、使用bootstrap的框架时,CSS样式引用错误但浏览器不会检查出错误,所以可以使用一个bootlint工具。

要加入文档,只需加入以下代码:

javascript:(function(){var s=document.createElement("script");s.onload=function(){bootlint.showLintReportForCurrentDocument([]);};s.src="https://maxcdn.bootstrapcdn.com/bootlint/latest/bootlint.min.js";document.body.appendChild(s)})();

2、bootstrap表格的一些样式

3、bootstrap栅格布局主要有两个类。.container和.container-fluid


container类:(1)宽度做了媒体查询。

                       (2)添加了前置后置内容生成,防止子元素的越界,以及浮动造成的影响。(:before:after)

container-fluid类:(1)宽度一直是width:auto;

                       (2)添加了前置后置内容生成,防止子元素的越界,以及浮动造成的影响。(:before:after)

container类一共12列。

其他特点:


4、:before:after的具体使用



1. CSS 相邻兄弟选择器 + 相邻兄弟选择器(Adjacent sibling selector)可选择紧接在另一元素后的元素,且二者有相同父元素。 相邻兄弟选择器使用了加号(+),即相邻兄弟结合符(Adjacent sibling combinator)。 2. 手机字体图标:`content: '\e958';` 电话字体图标:`content: '\e942';` 3. bootstrap最外层伸缩容器:`class="container"` 4. bootstrap伸缩布局并居中:`d-flex justify-content-center align-items-center` 5. `jQuery.data(element,[key],[value])`:在元素上存放数据,返回jQuery对象。 例如:在index界面中 ```javascript <div class="carousel-item active" data-sm-img="images/slide_01_900x410.jpg" data-lg-img="images/slide_01_2000x410.jpg"></div> <div class="carousel-item" data-sm-img="images/slide_02_900x410.jpg" data-lg-img="images/slide_02_2000x410.jpg"></div> <div class="carousel-item" data-sm-img="images/slide_03_900x410.jpg" data-lg-img="images/slide_03_2000x410.jpg"></div> ``` 在 js中,可以通过 ```javascript $('.carousel-item').data('lg-img') ``` 获取路径值。 6. bootstrap中圆角`rounded-circle` 7. 可以使用`order-*`调整显示顺序 8. 伸缩布局两步走`container+row` ```javascript <div class="container"> <div class="row"> *** </div> </div> ``` 9. 可以利用`offset`设置偏移量调整位置 10. 将jQuery对象转换为js对象可以直接通过下标取 11. 轮播图可以通过`.carousel('prev')`和`.carousel('next')`触发前后滑动事件 12. jQuery中缩小元素查找范围 ```javascript let $ul = $("#lk_product .nav"); let $allLis = $(".nav-item", $ul); ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值