コンテンツへスキップ
uencoder

CSS グラデーションを作成する方法

複数のカラーストップを持つ、線形および放射状の CSS グラデーションを生成します。

问题

背景や視覚効果のために CSS グラデーションが必要ですが、構文がよくわかりません。

前提条件

  • CSS の理解
  • 色形式に関する知識

ステップ

  1. 1. Choose the gradient type

    Linear gradients transition along a line (horizontal, vertical, or at an angle). Radial gradients radiate from a center point. Conic gradients sweep around a center. Choose based on the visual effect you want.

    入力
    type: linear, angle: 90deg
    输出
    linear-gradient(90deg, ...)
  2. 2. Define color stops

    Specify two or more color stops. Each stop has a color and optional position (0% to 100% or in px). Without explicit positions, stops are evenly distributed. Add more stops for complex transitions. Use rgba() for transparency.

    入力
    stops: #FF5733, #33FF57, #3357FF
    输出
    linear-gradient(90deg, #FF5733, #33FF57, #3357FF)
  3. 3. Generate and use the CSS

    The generator produces the CSS background property value. Copy it into your stylesheet. Test in the browser to verify the visual result. Adjust angles, positions, and colors as needed. For repeating gradients, use repeating-linear-gradient().

    入力
    gradient CSS
    输出
    background: linear-gradient(90deg, #FF5733, #3357FF);

期待される結果

目的の視覚効果を生み出す CSS グラデーション宣言。

よくあるエラー

Gradient not showing
Apply it to the background or background-image property, not background-color. Ensure the element has dimensions.
Color stops too close together
Spread the stops by specifying positions (e.g., 0%, 50%, 100%). Without positions, they are evenly spaced.

トラブルシューティング指引

  • If the gradient looks wrong, check the angle and color stop positions.
  • For smooth transitions, use colors with similar saturation and lightness.

セキュリティ上の制限

  • CSS gradient generation is a design tool with no security implications.

関連ツール

参考链接