Scroll

2 snippets in HTML & CSS

Also written as scroll to

HCHTML & CSS

Anchor Links (Jump to Section)

HC · Links & Navigation
syntax
<a href="#section-id">Jump</a>
...
<section id="section-id">Content</section>
example
<nav>
  <a href="#features">Features</a>
  <a href="#pricing">Pricing</a>
</nav>

<section id="features">...</section>
<section id="pricing">...</section>

Note Use scroll-behavior: smooth in CSS for an animated scroll to anchor targets. The id must be unique on the page.

Overflow

HC · Box Model
syntax
overflow: visible | hidden | scroll | auto | clip;
overflow-x: value;
overflow-y: value;
example
.card-body {
  max-height: 200px;
  overflow-y: auto;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-scroll {
  overflow: clip;
}

Note overflow: auto only shows scrollbars when content actually overflows, while scroll always shows them. overflow: clip is like hidden but does not create a scroll container, preventing programmatic scrolling. Combine overflow: hidden with text-overflow: ellipsis for truncated text.