footer通常寫版權(quán)信息等,顯示在頁面底部。如果頁面內(nèi)容過少,則footer會(huì)出現(xiàn)在屏幕中間位置,很尷尬。在 Tailwind 中,你可以使用flex來實(shí)現(xiàn)footer保持在屏幕或頁面底部。
代碼:
<div class="flex flex-col min-h-screen">
<slot />
<footer class="footer footer-center p-4 bg-base-300 text-base-content mt-auto">
<aside>
<p>Copyright ? 2023 - All right reserved by airoom.chat</p>
</aside>
</footer>
</div>
用flex包裹全部頁面內(nèi)容,footer設(shè)置類名:mt-auto 即可。文章來源:http://www.zghlxwxcb.cn/news/detail-714492.html
參考:playground文章來源地址http://www.zghlxwxcb.cn/news/detail-714492.html
到了這里,關(guān)于【Tailwind CSS】當(dāng)頁面內(nèi)容過少,怎樣讓footer保持在屏幕底部?的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!