You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

设置圆角的输入框在Safari中顶部出现白色像素问题

Fix Safari's White Pixel Issue on Input's Top Border-Radius

This is a common rendering quirk in Safari when dealing with inputs that have border-radius set but only a single visible border (in your case, the bottom border). Safari tends to fill the rounded corners with the border color even for the sides you've set to "none", which causes those white pixels to show up against your semi-transparent background.

Here are a few reliable fixes you can try:

1. Replace Border-Bottom with Box-Shadow

Instead of using border-bottom, use a box-shadow to simulate the bottom border. Box-shadow renders more cleanly with border-radius in Safari:

.loginTextField {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  /* Remove border-bottom and add this */
  box-shadow: 0 2px 0 0 white;
  border: none;
  outline: none;
}

2. Add Transparent Borders for Other Sides

Give the input transparent borders on all sides except the bottom. This gives Safari a "fill" for the rounded corners without showing visible borders:

.loginTextField {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  /* Replace border: none with this */
  border: 2px solid transparent;
  border-bottom: 2px solid white;
  outline: none;
}

3. Adjust Background Clip (Alternative)

If the above fixes don't work, try setting background-clip: padding-box to ensure the background doesn't bleed into the border area:

.loginTextField {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  border-bottom: 2px solid white;
  border: none;
  outline: none;
  background-clip: padding-box;
}

All these approaches should resolve the white pixel issue in Safari while keeping your desired styling intact in Chrome and other browsers.

内容的提问来源于stack exchange,提问作者LinusG.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:11:27