Open this example in the interactive library
Source code
<style>
.demo {
max-height: 24dvh;
overflow: auto;
}
</style>
<div class="demo">
<p style="height: 16rem">
This panel is capped at 24% of the preview height.
</p>
</div>
Size content from viewport height with native CSS. The preview includes a small shared demo stylesheet.
Open this example in the interactive library
<style>
.demo {
max-height: 24dvh;
overflow: auto;
}
</style>
<div class="demo">
<p style="height: 16rem">
This panel is capped at 24% of the preview height.
</p>
</div>