Scroll Snap new 滚动吸附 Scroll Snap web

01 / SNAPStart
02 / SNAPFocus
03 / SNAPShip
scroll-snap-align: start

标本可交互,可以直接操作。

Anatomy — every part, named解剖 —— 每个部件的名字

  1. 1 Snap container吸附容器 scroll-snap-type

    The scrolling element that defines the snap axis and strictness.

    定义滚动轴和吸附严格程度的滚动元素。

    Prompt fragmentPrompt 片段

    a horizontal or vertical overflow container with scroll-snap-type set deliberately for discrete panels

    一个明确设置 scroll-snap-type 的横向或纵向溢出容器,用于离散面板

Prompt — paste into your agentPrompt —— 直接粘贴给你的代理

Build a scroll-snap section rail with scroll-snap-type: y mandatory (or x mandatory for a carousel), scroll-snap-align: start on each panel, enough scroll padding for fixed UI, and a proximity fallback when strict snapping would fight natural reading.

构建一个滚动吸附区块轨道:轮播使用 scroll-snap-type: x mandatory,整屏区块使用 y mandatory;每个面板设置 scroll-snap-align: start;为固定 UI 预留 scroll-padding;严格吸附会影响阅读时改用 proximity。

Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时

Debug my scroll snap. Check that the container owns the overflow, children have scroll-snap-align, the axis matches the content flow, fixed headers are included in scroll-padding, nested scrollers do not chain unexpectedly, and mandatory snapping is avoided for long text panels. The symptom:

调试我的滚动吸附。检查 overflow 是否在正确的容器上;子项有 scroll-snap-align;轴向与内容流一致;固定头部已计入 scroll-padding;嵌套滚动不会意外串联;长文本面板避免使用 mandatory。症状:

In code代码里叫什么

Framework框架Symbol符号Note说明
CSS scroll-snap-type declare the axis and mandatory or proximity behavior声明滚动轴和 mandatory 或 proximity 行为
CSS scroll-snap-align mark the alignment edge for each child标记每个子项的对齐边缘
CSS overscroll-behavior keep nested snapping from chaining unexpectedly避免嵌套吸附意外串联

See also相关词条

我的参考集

组合知名网站、UI 元素、视觉风格和平面设计案例,导出给 AI。

你的下一份设计,从这里开始。

在任意案例旁点击「加入参考」,就能把品牌、组件、风格和平面设计案例组合成一份 AI 设计说明。

搜索参考库Search the library

输入关键词,搜索所有参考。