溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

bootstrap基礎(chǔ)

發(fā)布時(shí)間:2020-10-03 22:41:00 來源:網(wǎng)絡(luò) 閱讀:190 作者:wx5cb6ef2f9e3bc 欄目:web開發(fā)

bootstrap基礎(chǔ)
bootstra里面的布局模式
固定布局 container
流動(dòng)布局 container-fluid
<div class="container-fluid" style=" border: 1px solid black;height: 100px">
網(wǎng)格系統(tǒng)類似于table tr td
網(wǎng)格系統(tǒng)一行最大12列
row行
col--
代表屏幕分辨率
sm 小 540px
md 中 720px
lg 大
xl
col-xl-auto根據(jù)內(nèi)容自動(dòng)分配
col--num 列 后面的代表跨幾列
offset-1 設(shè)置marginleft值 8.333%
offset-
-2 不同的屏幕marginleft
invisible隱藏元素
visible顯示元素
p-0 padding:0
p-1 padding:0.25rem;
p-2
pt
py
w-100 100%
w-75 75%
h-100 100%
h-50 50%
align-items-center 相對父容器垂直居中p-0
align-items-start 相對父容器頂部對齊
align-items-end 相對父容器底部對齊

align-content-center 考慮多行

align-self-center 自身在flexbox中的y軸分布

justify-content-center 子元素在父容器里面的x軸的排布情況

12個(gè)均分,大小一樣
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">1</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">2</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">3</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">4</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">5</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">6</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">7</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">8</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">9</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">10</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">11</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">12</div>
1 2 3 3:2:7
<div class="col-sm-2 col-lg-1 col-md-4 col-xl-3">1</div>
<div class="col-sm-8 col-lg-6 col-md-4 col-xl-2">2</div>
<div class="col-sm-2 col-lg-5 col-md-4 col-xl-7">3</div>

5個(gè)均分,大小一樣
<div class="col">1</div>
<div class="col">2</div>
<div class="col">3</div>
<div class="col">4</div>
<div class="col">5</div>

pt-1 <div class="pt-1 col">1</div>
<div class="col">2</div>
<div class="col">3</div>

py-1 <div class="py-1 col">1</div>
<div class="col">2</div>
<div class="col">3</div>

w-100 <div class="w-100 col">1</div>
<div class="col">2</div>
<div class="col">3</div>

h-100 <div class="h-100 col">1</div>
<div class="col">2</div>
<div class="col">3</div>
1 2 3 連起來居中豎直
<div class="row align-content-center" style="border: 1px solid red; height: 300px">
<div class="col-lg-1 " style="height: 60px; border: 1px solid black">1</div>
<div class="w-100"></div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">2</div>
<div class="w-100"></div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">3</div>
</div>
1居中 2 3
<div class="row" style="border: 1px solid red; height: 300px">
<div class="col-lg-1 align-self-center" style="height: 60px; border: 1px solid black">1</div>
<div class="col-lg-1 align-self-end" style="height: 60px; border: 1px solid black">2</div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">3</div>
</div>
123接起來居中 水平
<div class="row justify-content-center" style="border: 1px solid red; height: 300px">
<div class="col-lg-1" style="height: 60px; border: 1px solid black">1</div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">2</div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">3</div>
</div>

媒體查詢
@media (min-width: 576px) {
.block{
width: 560px;
}
}
@media (min-width: 768px) {
.block{
width: 750px;
}
}
@media (min-width: 992px) {
.block{
width: 980px;
}
}
@media (min-width: 1200px) {
.block{
width: 1140px;
}
}
min-width要從小到大

   @media (max-width: 1200px) {
        .block{
            width: 1140px;
        }
    }

    @media (max-width: 992px) {
        .block{
            width: 980px;
        }
    }

    @media (max-width: 768px) {
        .block{
            width: 750px;
        }
    }
    @media (max-width: 576px) {
        .block{
            width: 560px;
        }
    }

max-width要從大到小

@media (max-width: 1200px) and (min-width: 993px) {
.block{
width: 1140px;
}
}

    @media (max-width: 992px) and (min-width: 769px) {
        .block{
            width: 980px;
        }
    }

    @media (max-width: 768px) and (min-width: 577px) {
        .block{
            width: 750px;
        }
    }
    @media (max-width: 576px) {
        .block{
            width: 560px;
        }
    }

元素浮動(dòng)根據(jù)分辨率去選擇
float-left左浮動(dòng)
float-right右浮動(dòng)
text-center 水平居中 left right justify sm xl md lg
<div class="row text-warning">
bootstrap
</div>
<div>
<span class="h2">bootstrap</span> 大小不同
<span class="h3">bootstrap</span>
<span class="h4">bootstrap</span>
<span class="h5">bootstrap</span>
<span class="small">bootstrap</span> small是正常大小的80%
<span class="close">×</span> 關(guān)閉特效 鼠標(biāo)有點(diǎn)擊效果 已經(jīng)做好的
</div>
<ul class="list-inline">
<li>bootstrap</li>
<li>bootstrap</li> 豎著排列
<li>bootstrap</li>
<li>bootstrap</li>
<li>bootstrap</li>
</ul>
<ul>
<li class="list-inline-item">bootstrap</li>
<li class="list-inline-item">bootstrap</li> 橫著排列
<li class="list-inline-item">bootstrap</li>
<li class="list-inline-item">bootstrap</li>
<li class="list-inline-item">bootstrap</li>
</ul>
圖片響應(yīng)式 img-fluid max-width:100% img-thumbnail 圖片外邊框加圓角
<div class="col-lg-1 float-left"><img class="img-fluid rounded " src="./img/1.jpg" alt=""/></div>
<div class="col-lg-1 float-right"><img class="img-fluid rounded " src="./img/1.jpg" alt=""/></div>
rounded

一些顏色屬性
table-primary table-danger table-success table-dark table-lighttable-info table-secondary
<table class="table table-hover table-bordered table-striped">
<tr class="table-active ">
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</table>

響應(yīng)式圖片比父容器大
code顏色字體
kbd黑底白色
samp加粗的樣子
img-thumbnail圓角
mx-aoto左右
組件alert alert-success alert-dismissible
<button>
提示框動(dòng)畫
膠囊形狀
進(jìn)度條

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI