其他分享
首页 > 其他分享> > Bootstarp5第二弹

Bootstarp5第二弹

作者:互联网

四、网格系统

网格系统根据设备屏幕尺寸大小分为6类

col-<!--任意屏幕-->
col-sm-<!--平板 - 屏幕宽度等于或大于 576px。-->
col-md-<!--桌面显示器 - 屏幕宽度等于或大于 768px。-->
col-lg-<!--大桌面显示器 - 屏幕宽度等于或大于 992px。-->
col-xl-<!--特大桌面显示器 - 屏幕宽度等于或大于 1200px。-->
col-xxl-<!--超大桌面显示器 - 屏幕宽度等于或大于 1400px。-->
创建等宽响应式列
<div class="row">
    <div class="col p-3 bg-primary text-white">.col</div>
    <div class="col p-3 bg-dark text-white">.col</div>
    <div class="col p-3 bg-primary text-white">.col</div>
  </div>
创建不等宽响应式列
<div class="row">
    <div class="col-sm-3 p-3 bg-primary text-white">.col</div>
    <div class="col-sm-4 p-3 bg-dark text-white">.col</div>
    <div class="col-sm-3 p-3 bg-primary text-white">.col</div>
  </div>
设置某一列的宽度
<div class="row">
    <div class="col">.col</div>
    <div class="col-4">.col</div>
    <div class="col">.col</div>
  </div>
平板和桌面端
<div class="row">
    <div class="col-sm-3 col-md-6 col-lg-4 col-xl-2 p-3 bg-primary text-white">.col</div>
    <div class="col-sm-9 col-md-6 col-lg-8 col-xl-10 p-3 bg-dark text-white">.col</div>
  </div>
嵌套列
<div class="row">
		<div class="col-8 border p-3 bg-dark text-white">.col-8
			<div class="col-6 border p-3 bg-dark text-white">.col-6</div>
			<div class="col-6 border p-3 bg-white text-dark">.col-6</div>
		</div>
			<div class="col-4 border p-3 bg-primary text-white">.col-4
		</div>
	</div>
偏移列(offset)
<div class="row">
    <div class="col-md-4 bg-primary text-white">.col-md-4</div>
    <div class="col-md-4 offset-md-4 bg-dark text-white">.col-md-4 offset-md-4</div>
</div>
<div class="row">
    <div class="col-md-3 offset-md-3 bg-primary text-white">.col-md-3 offset-md-3</div>
    <div class="col-md-3 offset-md-3 bg-dark text-white">.col-md-3 offset-md-3</div>
</div>
<div class="row">
    <div class="col-md-6 offset-md-6 bg-primary text-white">.col-md-6 offset-md-6</div>
</div>
<!--不要忘记加上class="row"-->

标签:md,Bootstarp5,创建,第二,网格,响应,offset,col
来源: https://www.cnblogs.com/liuzijin/p/16529887.html