问题描述
我有这个 html:
<div class="container h-screen w-screen">
<div class="navBar h-7"></div>
<div class="content-container"></div>
</div>
我已将 .navBar 的高度设置为 h-7。 现在我想将 .content-container 的高度设置为 100vh-(h-7)。
我如何使用 calc() 来设置它?
解决方法
theme()
使用 theme()
函数通过点表示法访问您的 Tailwind 配置值。
当您只想为声明的一部分引用主题配置中的值时,这可能是 @apply
的有用替代方法:
.content-container {
height: calc(100vh - theme('spacing.7'));
}