YL

BUTTON

按压按钮Press Button

底下一截同色实心阴影,按下时按钮沉进去,阴影跟着变短。

中英对照

中文
按压按钮
英文
Press Button
别名
下沉按钮、厚底按钮、3D Press
一句话
底下一截同色实心阴影,按下时按钮沉进去,阴影跟着变短。

效果预览

常见变体

浅色按压Light Press Button

白底深字的次按钮版本,厚度用浅灰实边,和实心按压主按钮成对使用。

适合用在哪

支付确认、游戏化产品、任何想让点击有「按下去了」手感的主操作。

不适合:扁平、极简或玻璃风格的界面:同色厚底带有明显的拟物感,混进扁平按钮体系里像另一套组件;32px 以下的小按钮(表格行内、工具栏)也做不出能感知的键程。

和相近模式的区别

涟漪按钮Ripple Button

按钮是扁平的、做不出「厚度」,或者产品走 Material 风格时,换涟漪:按钮本身不动,从按压点扩散一圈水波,指出「点在了哪里」,代价是要用 JS 读取坐标。两者也可以共存:先下沉,再在按压点出现涟漪。

容易踩的坑

  • 用大而软的投影冒充厚度,按下时没有「键程」,看起来只是普通悬停。
  • 再叠加磁吸位移,按下时按钮一边下沉一边跟着光标飘。
  • :active 的位移超过阴影厚度,按钮像陷进页面里,松手后又弹得太高。

设计提示词 · Prompt

按压按钮(Press Button):静止时 box-shadow:0 4px 0 比按钮底色深一档的纯色,像一枚有厚度的键。:hover 先下沉 1px、阴影收到 3px;:active 时 translateY(4px) 且阴影收到 0,过渡 120ms。阴影用同色实边,不要用大而软的投影冒充厚度。按钮高度 44-48px,圆角 10-12px。可以和涟漪共存,不要再叠加磁吸位移,否则按下时位置会飘。prefers-reduced-motion 时保留颜色,去掉位移动画。
Press Button: at rest, box-shadow:0 4px 0 in a solid color one step darker than the fill, like a key with thickness. On hover, sink 1px and shorten the shadow to 3px; on active, translateY(4px) and collapse the shadow to 0, over 120ms. Use a solid same-hue edge, not a large soft shadow pretending to be thickness. Height 44-48px, radius 10-12px. It can coexist with a ripple, but don't also add magnetic translation or the button drifts while being pressed. Under prefers-reduced-motion, keep the color and drop the movement.

可复制 CSS

自包含的最小实现,粘贴到空白页面即可生效;类名可以按项目规范改名。

/* <button class="press-btn" type="button">确认支付</button> */
.press-btn {
  --press-bg: #4f46e5;
  --press-edge: #3730a3;
  height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: 12px;
  background: var(--press-bg);
  color: #fff;
  font: 600 15px/1 system-ui, sans-serif;
  box-shadow: 0 4px 0 var(--press-edge);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
@supports (color: color-mix(in oklab, red, blue)) {
  .press-btn { --press-edge: color-mix(in oklab, var(--press-bg) 70%, black); }
}
.press-btn:hover { transform: translateY(1px); box-shadow: 0 3px 0 var(--press-edge); }
.press-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--press-edge); }
.press-btn:focus-visible { outline: 2px solid var(--press-bg); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .press-btn, .press-btn:hover, .press-btn:active {
    transform: none;
    box-shadow: 0 4px 0 var(--press-edge);
    transition: none;
  }
  .press-btn:active { background: var(--press-edge); }
}

演示 HTML 结构

<div class="s" style="display:flex;justify-content:center;padding:18px 0">
  <button class="d-pressbtn" type="button">确认支付</button>
</div>

无障碍与性能

无障碍

  • 按压只是视觉反馈,按钮仍用原生 <button>,Enter 和空格键都能触发。
  • prefers-reduced-motion: reduce 时去掉位移,按下改为加深底色,用户仍能看到「按下去了」。

性能

  • 只过渡 transform 和 box-shadow;无模糊的纯色 box-shadow 重绘成本很低。

常见问题

按压按钮的英文是什么?

按压按钮的英文是 Press Button。常见英文别名还包括 3D Press。

Press Button 的中文是什么?

Press Button 的中文是「按压按钮」。常见中文别名还包括 下沉按钮、厚底按钮。底下一截同色实心阴影,按下时按钮沉进去,阴影跟着变短。

按钮的厚度用 box-shadow 还是 border-bottom 做?

用 box-shadow。border-bottom 占据布局空间,按下时把它从 4px 改成 0 会让按钮总高度变化,下方内容跟着跳;box-shadow 不参与布局,配合 transform 位移,周围元素完全不动。

厚度阴影的颜色能根据按钮底色自动算吗?

可以用 color-mix(in oklab, 底色 70%, black) 混出深一档的颜色,Chrome 111、Safari 16.2、Firefox 113 起支持。注意兜底不能靠「同一个自定义属性写两遍」:自定义属性不做语法校验,后一行总会覆盖前一行,不支持时会在使用处失效。要像本条这样先写固定色,再在 @supports 里覆盖。

常见搭配

同一页面里经常和「按压按钮」一起出现的模式,可以收藏后用「组合收藏为整页提示词」一起交给 AI。

所属设计风格

「按压按钮」是这些整体设计风格的常见组成部分,在设计风格词典里可以看到整页效果。

标签