A box of fixed height whose content scrolls inside it, with a thin scrollbar that keeps contrast.
<div class="cap-scroll-area" id="sa-rest" tabindex="0" role="region" aria-label="Sample excerpt" style="--scroll-area-max: 10rem">
<p>The spring survey covered twelve sites along the creek, each visited once a week from March to May.</p>
<p>Counts rose through April and fell in the first week of May, when the water was highest.</p>
<p>Two sites were dry for most of March and are left out of the totals.</p>
<p>The full counts, by site and by week, are in the annual report.</p>
<p>Next season adds three sites upstream and moves the visits to Tuesdays.</p>
</div>
<div class="cap-scroll-area" data-frame="none" tabindex="0" role="region" aria-label="Release notes" style="--scroll-area-max: 6rem">
<p>Added the card, the carousel and the marquee.</p>
<p>Fixed the header's border when stuck.</p>
<p>Removed the old scrollbar rules.</p>
<p>Updated the docs.</p>
</div>
API reference
CSS variables
Variable
Default
--scroll-area-max
24rem
--scrollbar-thumb
var(--muted)
--scrollbar-track
var(--sunken)
Parts and data attributes
Class
Is
.cap-scroll-area
the root
Attribute
Values
data-frame
none
Accessibility
Key
Does
Tab
Reaches the area (skip tabindex only when something inside it already takes focus)