W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
用于控制網(wǎng)格項(xiàng)目如何沿其內(nèi)聯(lián)軸對(duì)齊的功能類。
Class
|
Properties
|
---|---|
justify-items-start | justify-items: start; |
justify-items-end | justify-items: end; |
justify-items-center | justify-items: center; |
justify-items-stretch | justify-items: stretch; |
使用 ?justify-items-start
? 使網(wǎng)格項(xiàng)目沿內(nèi)聯(lián)軸的起點(diǎn)排列。
<div class="grid justify-items-start ...">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
使用 ?justify-items-end
? 使網(wǎng)格項(xiàng)目沿內(nèi)聯(lián)軸的終點(diǎn)排列。
<div class="grid justify-items-end ...">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
使用 ?justify-items-center
? 使風(fēng)格項(xiàng)目沿著他們的內(nèi)聯(lián)軸對(duì)齊。
<div class="grid justify-items-center ...">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
使用 ?justify-items-stretch
? 沿其內(nèi)聯(lián)軸拉伸項(xiàng)目。
<div class="grid justify-items-stretch ...">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
要在特定的斷點(diǎn)處對(duì) flex 項(xiàng)目應(yīng)用 justify 功能類,請(qǐng)?jiān)谌魏维F(xiàn)有的功能類前添加 ?{screen}:
? 前綴。例如,使用 ?md:justify-items-center
? 來(lái)僅在中等尺寸以上的屏幕應(yīng)用 ?justify-items-center
? 功能類。
<div class="justify-items-start md:justify-items-center">
<!-- ... -->
</div>
關(guān)于 Tailwind 的響應(yīng)式設(shè)計(jì)功能的更多信息,請(qǐng)查看 響應(yīng)式設(shè)計(jì) 文檔。
默認(rèn)情況下, 針對(duì) justify-items 功能類,只生成 responsive 變體。
您可以通過(guò)修改您的 ?tailwind.config.js
? 文件中的 ?variants
?部分中的 ?justifyItems
?屬性來(lái)控制為 justify-items 功能生成哪些變體。
例如,這個(gè)配置也將生成 hover and focus 變體:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
justifyItems: ['hover', 'focus'],
}
}
}
如果您不打算在您的項(xiàng)目中使用 justify-items 功能,您可以通過(guò)在配置文件的 ?corePlugins
?部分將 ?justifyItems
?屬性設(shè)置為 ?false
?來(lái)完全禁用它們:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
justifyItems: false,
}
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: