我正在尝试为我的Nuxt 3应用程序使用tailwind制作一个自定义的404错误页面。
我希望该页面在所有设备上都能填满屏幕,404错误页面在垂直和水平方向上居中,但是我无法使其垂直居中。即使在包装的
在Tailwind UI组件中的一个示例中,它说:“此示例需要更新您的模板”:
<html class="h-full"> <body class="h-full">
如何在Nuxt 3的特定page.vue中轻松添加tailwind类到html和body标签中?
我尝试在page.vue中添加以下内容:
<script setup>
useHead({
htmlAttrs: {
style: 'html: h-full'
},
bodyAttrs: {
style: 'body: h-full'
}
})
</script>
<style>
html,
body {
margin: 0;
padding: 0;
}
</style> Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号