Horizontal Scroll Section new 横向滚动区块 Horizontal Scroll web
A vertical gesture that advances a horizontal strip of content
用上下滚动手势推进横向卡片带的页面区块
标本可交互,可以直接操作。
Anatomy — every part, named解剖 —— 每个部件的名字
-
1 Horizontal rail横向轨道
display: flex + overflow-xThe row whose content extends beyond the viewport along the x axis.
沿 x 轴超出视口、内容继续延伸的一排元素。
Prompt fragmentPrompt 片段a non-shrinking horizontal flex rail with gap, overflow-x auto, and optional scroll-snap-align on each card
一个不收缩的横向 flex 轨道,带间距、overflow-x: auto,并可为每张卡片设置 scroll-snap-align
Prompt — paste into your agentPrompt —— 直接粘贴给你的代理
Create a horizontal card rail that remains discoverable and keyboard accessible. On desktop, map the section progress to translateX only when the storytelling requires vertical-to-horizontal movement; otherwise expose overflow-x: auto, keep cards snap-aligned, and provide visible affordance and reduced-motion behavior.
创建一个可发现且支持键盘访问的横向卡片带。桌面端只有在叙事确实需要时才将区块进度映射为 translateX;否则提供 overflow-x: auto 的真实滚动轨道,卡片保持吸附对齐,显示滚动提示,并支持减少动态效果。
Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时
Debug my horizontal scroll section. Check that the rail has a real overflow width, cards do not shrink below their intended size, the vertical-to-horizontal mapping does not trap the page, keyboard focus can reach every card, touch gestures remain usable, and reduced motion falls back to a normal horizontal rail. The symptom:
调试我的横向滚动区块。检查轨道有真实的溢出宽度;卡片不会缩小到目标尺寸以下;上下转横向的映射不会困住页面;键盘焦点能到达每张卡片;触摸手势可用;减少动态效果时回退为普通横向轨道。症状:
In code代码里叫什么
| Framework框架 | Symbol符号 | Note说明 |
|---|---|---|
| CSS | overflow-x: auto | provide a real horizontal scrolling surface提供真实的横向滚动表面 |
| CSS | scroll-snap-type: x proximity | optionally settle cards into readable positions可选,让卡片停在易读位置 |
| CSS | touch-action: pan-x | keep touch interaction predictable on direct rails让触摸交互在直接轨道上保持可预期 |