W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
用于控制單個(gè)網(wǎng)格項(xiàng)如何沿其內(nèi)聯(lián)軸對(duì)齊的功能類。
Class
|
Properties
|
---|---|
justify-self-auto | justify-self: auto; |
justify-self-start | justify-self: start; |
justify-self-end | justify-self: end; |
justify-self-center | justify-self: center; |
justify-self-stretch | justify-self: stretch; |
使用 ?justify-self-auto
? 根據(jù)網(wǎng)格的 ?justify-items
? 屬性的值來(lái)對(duì)齊一個(gè)項(xiàng)目:
<div class="grid justify-items-stretch ...">
<!-- ... -->
<div class="justify-self-auto ...">1</div>
<!-- ... -->
<!-- ... -->
<!-- ... -->
<!-- ... -->
</div>
使用 ?justify-self-start
? 將網(wǎng)格項(xiàng)沿內(nèi)聯(lián)軸起點(diǎn)對(duì)齊:
<div class="grid justify-items-stretch ...">
<!-- ... -->
<div class="justify-self-start ...">1</div>
<!-- ... -->
<!-- ... -->
<!-- ... -->
<!-- ... -->
</div>
使用 ?justify-self-center
? 將網(wǎng)絡(luò)項(xiàng)沿其內(nèi)聯(lián)軸的中心對(duì)齊。
<div class="grid justify-items-stretch ...">
<!-- ... -->
<div class="justify-self-center ...">1</div>
<!-- ... -->
<!-- ... -->
<!-- ... -->
<!-- ... -->
</div>
使用 ?justify-self-end
? 將網(wǎng)格項(xiàng)沿內(nèi)聯(lián)軸終點(diǎn)對(duì)齊:
<div class="grid justify-items-stretch ...">
<!-- ... -->
<div class="justify-self-end ...">1</div>
<!-- ... -->
<!-- ... -->
<!-- ... -->
<!-- ... -->
</div>
使用 ?justify-self-stretch
? 來(lái)拉伸一個(gè)網(wǎng)格項(xiàng),以填充其內(nèi)聯(lián)軸上的網(wǎng)格區(qū)域。
<div class="grid justify-items-start ...">
<!-- ... -->
<div class="justify-self-stretch ...">1</div>
<!-- ... -->
<!-- ... -->
<!-- ... -->
<!-- ... -->
</div>
要在特定的斷點(diǎn)處控制網(wǎng)格項(xiàng)在其網(wǎng)格區(qū)域內(nèi)的對(duì)齊,可以在任何現(xiàn)有的功能類前添加 ?{screen}:
? 前綴。例如,使用 ?md:justify-self-end
? 來(lái)僅在中等尺寸及以上的屏幕應(yīng)用 ?justify-self-end
? 功能。
關(guān)于 Tailwind 的響應(yīng)式設(shè)計(jì)功能的更多信息,請(qǐng)查看 響應(yīng)式設(shè)計(jì) 文檔。
默認(rèn)情況下, 針對(duì) justify-self 功能類,只生成 responsive 變體。
您可以通過(guò)修改您的 ?tailwind.config.js
? 文件中的 ?variants
?部分中的 ?justifySelf
?屬性來(lái)控制為 justify-self 功能生成哪些變體。
例如,這個(gè)配置也將生成 hover and focus 變體:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
justifySelf: ['hover', 'focus'],
}
}
}
如果您不打算在您的項(xiàng)目中使用 justify-self 功能,您可以通過(guò)在配置文件的 ?corePlugins
?部分將 ?justifySelf
?屬性設(shè)置為 ?false
?來(lái)完全禁用它們:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
justifySelf: 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)系方式:
更多建議: