Размеры
Утилиты для установки максимальной высоты элемента
Установите максимальную высоту элемента с помощью утилит max-h-full
или max-h-screen
.
<div class="h-24 ...">
<div class="h-48 max-h-full ...">
<!-- ... -->
</div>
</div>
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:max-h-screen
to only apply the max-h-screen
utility on hover.
<div class="h-48 max-h-full hover:max-h-screen">
<!-- ... -->
</div>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:max-h-screen
to apply the max-h-screen
utility at only medium screen sizes and above.
<div class="h-48 max-h-full md:max-h-screen">
<!-- ... -->
</div>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.
По умолчанию шкала максимальной высоты Tailwind использует комбинацию шкалы интервалов по умолчанию, а также некоторых дополнительных значений, связанных с высотой.
Вы можете настроить масштаб интервалов, отредактировав theme.spacing
или theme.extend.spacing
в вашем файле tailwind.config.js
.
module.exports = {
theme: {
extend: {
spacing: {
'128': '32rem',
}
}
}
}
Кроме того, вы можете настроить только масштаб максимальной высоты, отредактировав theme.maxHeight
или theme.extend.maxHeight
в вашем файле tailwind.config.js
.
module.exports = {
theme: {
extend: {
maxHeight: {
'128': '32rem',
}
}
}
}
Дополнительные сведения о настройке темы по умолчанию смотрите в документации настройка темы.
If you need to use a one-off max-height
value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.
<div class="max-h-[32rem]">
<!-- ... -->
</div>
Learn more about arbitrary value support in the arbitrary values documentation.