F

CSS 阴影生成器CSS Shadow Generator

可视化生成CSS box-shadow代码Visually generate CSS box-shadow code.

box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.25);

预设样式

关于 CSS 阴影生成器About CSS Shadow Generator

合适的 box-shadow 能让卡片、按钮瞬间拥有层次感与质感。本工具可视化调节阴影的水平/垂直偏移、模糊半径、扩展半径与颜色,支持多层阴影叠加与内阴影,实时生成 CSS 代码。The right box-shadow instantly gives cards and buttons depth and polish. This tool visually tunes horizontal/vertical offset, blur, spread and colour, supports stacked multi-shadows and inset shadows, and generates CSS code live.

使用方法How to Use

  1. 调整水平/垂直偏移决定阴影方向。Adjust horizontal/vertical offset to set the shadow direction.
  2. 调整模糊与扩展半径控制阴影的柔和度与范围。Tune blur and spread to control softness and reach.
  3. 选择阴影颜色与透明度,需要内阴影时勾选 inset。Pick the shadow colour and opacity; tick inset for inner shadows.
  4. 复制生成的 box-shadow 代码使用。Copy the generated box-shadow code.

常见问题FAQ

怎样让阴影看起来自然?How do I make shadows look natural?

使用低透明度黑色(如 rgba(0,0,0,0.1))、较大模糊、较小偏移;叠加一深一浅两层阴影会更接近真实光照。Use low-opacity black (e.g. rgba(0,0,0,0.1)), large blur and small offset; stacking a tight and a soft shadow approximates real lighting.

inset 阴影有什么用?What is an inset shadow for?

inset 把阴影绘制在元素内部,常用于输入框凹陷感、压印文字等拟物效果。inset draws the shadow inside the element, commonly used for pressed input fields and embossed effects.

大量阴影会影响性能吗?Do many shadows hurt performance?

阴影会触发额外绘制,在长列表或低端设备上大面积阴影可能掉帧;可减小模糊半径、用预渲染图或仅在悬停时显示。Shadows cost extra painting; large blurs on long lists or low-end devices can drop frames. Reduce blur, use pre-rendered images, or show shadows only on hover.

相关阅读Related Reading

相关工具Related Tools