• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

Css Basic: spreadMethod

December 20, 2023

CSS Basics: spreadMethod

In CSS, the spreadMethod property is used in conjunction with the linearGradient() and radialGradient() functions to define how the gradient colors are spread within a shape or element. This property allows you to control the distribution of colors in a gradient, giving you more control over the visual appearance of your designs.

Understanding spreadMethod

The spreadMethod property has three possible values:

  • pad: This is the default value. It extends the last color of the gradient beyond the shape’s boundaries, creating a solid color fill.
  • reflect: This value reflects the gradient colors at the shape’s boundaries, creating a mirrored effect.
  • repeat: This value repeats the gradient colors beyond the shape’s boundaries, creating a seamless pattern.

By using these different spread methods, you can achieve various visual effects and enhance the overall design of your website or application.

Examples

Let’s take a look at some examples to better understand how the spreadMethod property works:

Example 1: pad

.gradient {
  background: linear-gradient(to right, red, blue);
  spreadMethod: pad;
}

In this example, the gradient colors will extend beyond the shape’s boundaries, creating a solid fill. The colors will smoothly transition from red to blue within the shape, and the last color (blue) will continue beyond the shape.

Example 2: reflect

.gradient {
  background: linear-gradient(to right, red, blue);
  spreadMethod: reflect;
}

With the reflect value, the gradient colors will be reflected at the shape’s boundaries, creating a mirrored effect. This can be useful when you want to add depth or dimension to your designs.

Example 3: repeat

.gradient {
  background: linear-gradient(to right, red, blue);
  spreadMethod: repeat;
}

Using the repeat value, the gradient colors will repeat beyond the shape’s boundaries, creating a seamless pattern. This can be particularly effective when you want to create a background with a repeating gradient.

Conclusion

The spreadMethod property in CSS allows you to control how gradient colors are spread within a shape or element. By using the pad, reflect, or repeat values, you can achieve different visual effects and enhance the overall design of your website or application.

To learn more about CSS and how it can improve your website’s performance and design, consider exploring Server.HK, a leading VPS hosting company that offers reliable and high-performance hosting solutions.

Recent Posts

  • Hong Kong VPS vs Singapore VPS: Which Is Better for Your Asia Business in 2026?
  • How to Migrate from CentOS 8 to AlmaLinux or Rocky Linux Safely
  • CentOS Server Performance Tuning: Optimization Techniques for 2026
  • How to Configure SELinux in CentOS Without Breaking Your System (CentOS Stream 9/10 – 2026)
  • Managing Users and Permissions in CentOS Stream: Best Practices (CentOS Stream 9/10 – 2026)

Recent Comments

No comments to show.

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot