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