Skip to content

CSS Property Generator - Gradients, Shadows & Borders

Free CSS property generator for custom gradients, box shadows, border radius & text shadows. Visual editor with live preview. Copy CSS code instantly.

CSS Property Generator

90°
0%
100%

Generated CSS

css
background: #ff5f6d;
background: linear-gradient(90deg, #ff5f6d 0%, #ffc371 100%);
Loading calculator...
📚

Documentation

CSS Property Generator

A CSS property generator is a tool that builds CSS code for a visual effect from a set of sliders and color pickers, instead of the user typing the code by hand. This one covers four effects: gradients, box shadows, border radius, and text shadows. Each panel shows a live preview and produces ready-to-copy CSS.

What it generates

  • Gradients: linear or radial color transitions between two colors
  • Box shadows: a drop shadow or inset shadow around an element, with offset, blur, spread, color, and opacity controls
  • Border radius: rounded corners, either the same on all four corners or set individually
  • Text shadows: a shadow behind text, with offset, blur, color, and opacity controls

Every setting updates the preview and the generated CSS at the same time, so changes can be checked before the code is copied.

How to calculate a CSS linear gradient

A linear gradient moves from one color to another along a straight line. Its CSS syntax is:

1background: linear-gradient(angle, color1 position1%, color2 position2%);
2

The angle is measured in degrees, from 0 to 360. position1 and position2 set where each color reaches full strength, as a percentage of the gradient's length.

Example

The generator's starting values are a 90-degree angle, #ff5f6d at 0%, and #ffc371 at 100%. That produces:

1background: #ff5f6d;
2background: linear-gradient(90deg, #ff5f6d 0%, #ffc371 100%);
3

The first line is a plain color fallback for browsers that, for some reason, fail to render the gradient. The second line is the gradient itself.

Radial gradient formula

A radial gradient spreads outward from a center point instead of along a line:

1background: radial-gradient(circle, color1 position1%, color2 position2%);
2

This generator always produces a circular radial gradient. It does not offer an ellipse shape option or a way to move the center point; only the two colors and their stop positions can be changed.

Both gradient types in this tool use exactly two colors, set with the Color 1 and Color 2 pickers. There is no option to add a third color stop.

CSS box shadow formula

A box shadow is a shadow drawn around an element's edges:

1box-shadow: h-offset v-offset blur spread color;
2

h-offset and v-offset move the shadow left/right and up/down. Positive values push it right or down; negative values push it left or up. blur softens the shadow's edge; a higher number spreads the softness further. spread grows or shrinks the shadow's size before blur is applied. Adding the keyword inset before the offsets draws the shadow inside the element's border instead of outside it.

Example

With the default settings (5px horizontal offset, 5px vertical offset, 10px blur, 0px spread, black at 20% opacity), the tool outputs:

1box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.2);
2

The color picker's opacity slider runs from 0 to 100 and is converted to the 0-to-1 scale that rgba() uses, so 20% becomes 0.2.

CSS border radius formula

Border radius rounds an element's corners. Two forms exist:

1border-radius: value;                              /* same on all four corners */
2border-radius: top-left top-right bottom-right bottom-left; /* set separately */
3

When all four corners share one value, the generator writes the short form. When they differ, it lists the four values in that exact order: top-left, then top-right, then bottom-right, then bottom-left.

Example

The default radius is 10px on every corner:

1border-radius: 10px;
2

A circular avatar image typically uses border-radius: 50% instead, though that value is outside the range this generator's slider allows (0 to 100 pixels).

CSS text shadow formula

A text shadow behaves like a box shadow but has no spread value and applies to letters instead of an element's box:

1text-shadow: h-offset v-offset blur color;
2

Example

With the default settings (2px horizontal offset, 2px vertical offset, 3px blur, black at 50% opacity):

1text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
2

How to use the CSS property generator

  1. Pick a tab: Gradient, Box Shadow, Border Radius, or Text Shadow.
  2. Adjust the sliders, color pickers, and checkboxes. The preview panel and the CSS code both update immediately.
  3. Select the "Copy to Clipboard" button and paste the code into a stylesheet or a style attribute.
  4. Select "Reset" to return every field across all four tabs to its starting value. This also switches the active tab back to Gradient, even if a different tab was being viewed.

Frequently asked questions

What is a CSS property generator used for? It turns slider and color-picker input into finished CSS code for gradients, shadows, and rounded corners, so the person using it does not have to write or memorize that syntax by hand.

What's the difference between a linear and a radial gradient? A linear gradient changes color along a straight line at a set angle. A radial gradient changes color outward from a center point. This tool's radial option always uses a circular shape.

Can this tool create a gradient with more than two colors? No. Both the linear and radial gradient panels support exactly two colors, Color 1 and Color 2, each with its own stop position.

How is an inset box shadow different from a regular one? A regular box shadow sits outside the element's edges, like light falling behind it. An inset shadow sits inside the edges instead, making the element look pressed in rather than raised up.

Why do the rounded-corner values appear in the order top-left, top-right, bottom-right, bottom-left? That order is how the CSS border-radius property expects four separate values to be written, moving clockwise starting from the top-left corner.

Does the generated CSS work in every browser? Gradients, box shadows, border radius, and text shadows are all supported in current versions of Chrome, Firefox, Safari, and Edge. No vendor prefixes are added to the output.

References

  1. MDN Web Docs: Using CSS gradients
  2. MDN Web Docs: box-shadow
  3. MDN Web Docs: border-radius
  4. MDN Web Docs: text-shadow