To make a linear gradient in Adobe Illustrator, select a filled object, choose the Gradient tool, and drag across the artwork to define the gradient’s direction and length.
That creates one straight color transition inside the selected shape. Use the Gradient panel to set the type, refine the colors, and control where the transition changes most noticeably.

Create the linear gradient in Adobe Illustrator
- Select the target artwork. Use the Selection tool to choose the shape that should receive the gradient. Confirm that the shape has a fill; otherwise, the gradient may not be visible.
- Open the Gradient tool and panel. Double-click the Gradient tool in the toolbar to open the Gradient panel while keeping the tool available for drawing on the artwork.
- Change the gradient type to Linear. In the Gradient panel’s Type menu, select Linear. This distinguishes a straight, one-direction transition from a radial or mesh gradient.
- Draw the gradient across the object. Click and drag from the point where the first color should begin toward the point where the last color should end. The drag establishes the gradient line, its direction, and how far the transition extends.
- Edit the gradient colors. Double-click the gradient swatch in the Gradient panel to open its color controls. Set the start and end colors, then adjust the midpoint marker if the blend should happen earlier or later.
- Refine or reverse the direction. If the colors run in the wrong order, make the drag in the opposite direction or edit the gradient swatch again. Keep the shape selected while checking the result so that changes affect only the intended object.
If the artwork remains a solid color, check the selected shape and its fill first. If the transition looks too compressed, make a longer drag across the artwork; if it spreads too far, shorten the drag.
Set the direction and color transition
The most reliable way to control an Illustrator gradient is to think in terms of its start and end. The first color is anchored at the beginning of the gradient line, while the last color is anchored at the opposite end. The midpoint determines where the two ends meet most strongly.
For a controlled transition, use these adjustments:
- Move the midpoint: Shift it toward the start for a quicker change from the first color or toward the end for a slower change.
- Change the drag length: A shorter gradient line concentrates the transition within a smaller area of the artwork.
- Use clearly different test colors: Two distinct colors make direction and midpoint placement easier to judge before refining the palette.
- Check the shape’s proportions: The same gradient line can create a different-looking diagonal when the artwork becomes wider or narrower.
For a web version, do not assume an Illustrator angle or drag direction will carry into CSS with the same numeric meaning. CSS uses its own angle convention, so set the browser direction separately and compare it with the approved Illustrator design.
Translate the Illustrator gradient into CSS
Once the Illustrator gradient is approved, use the CSS Gradient Generator for the browser handoff. The generator does not modify Illustrator artwork or produce an Illustrator file. It creates a browser CSS declaration from exactly three colors, one angle, and three ordered percentage stops.
- Record three colors as six-digit hexadecimal values. Choose the colors that represent the start, midpoint, and end of the Illustrator gradient. The generator requires complete six-digit hex colors and does not accept alpha transparency as part of those values.
- Set the CSS angle. Enter a value from 0 through 360 degrees. CSS angles describe the gradient line, not the position of the gradient box: 0 degrees points upward, 90 degrees points right, 180 degrees points downward, and 270 degrees points left. A value of 360 degrees is accepted as the boundary equivalent of 0 degrees.
- Place the stops in ascending order. Start with the first color at 0 percent, the middle color at 50 percent, and the last color at 100 percent, then move the middle stop as needed. Descending stops are rejected because the generator requires explicit ascending order. Equal adjacent stops are allowed and produce a hard transition.
- Inspect and copy the declaration. The preview uses the exact linear-gradient value returned in the CSS declaration, so the preview and copied code share one source of truth. Copy the declaration only after the direction and color transition match your intention.
- Apply and test it in the page. Paste the declaration into the element’s stylesheet, then test the real content across the complete gradient and at different responsive sizes. The generator does not calculate contrast or custom color-space interpolation, so browser rendering and the surrounding design still require review.
| CSS angle | Gradient-line direction |
|---|---|
| 0 degrees | Up |
| 90 degrees | Right |
| 180 degrees | Down |
| 270 degrees | Left |
| 360 degrees | Equivalent to 0 degrees |
For the complete browser syntax, consult MDN’s gradient data type reference. The copied declaration uses the background shorthand. If an element also needs a separate background color, image layer, position, or size, integrate those properties deliberately or use background-image so the shorthand does not reset unrelated settings.
The generator is intentionally focused on one three-color linear layer. It does not provide radial, conic, repeating, transparency-alpha, or custom interpolation-space controls, and CSS stops outside the zero-to-100-percent range are outside its supported workflow. Multiple browser gradients therefore require additional CSS work.
Test the gradient at its final size
A gradient that looks balanced in the Gradient panel can behave differently after it is placed behind text, controls, or images. Test the exact component rather than judging an isolated color strip.
- Check multiple dimensions: Preview the element at desktop and mobile widths. The apparent diagonal changes with the gradient box’s aspect ratio.
- Test the entire text area: Text may have adequate contrast over one part of the gradient and inadequate contrast over another. Do not rely on a single sampled color.
- Review control states: Check hover, focus, disabled, and active states where they share the gradient background.
- Consider a fallback: An overlay or solid background can protect readability when a strong multi-color transition interferes with hierarchy.
- Test supported environments: Review printing, screenshots, and forced-color behavior when those environments matter to the project.
Browser color interpolation can also affect the perceived midpoint. For brand-critical or perceptually uniform results, verify the output in the exact browsers and color requirements supported by the project. The tool runs locally in the current tab, so its values are not uploaded or saved, but that does not replace browser testing.
Fix common Illustrator and CSS issues
Most gradient problems come from an unclear start point, an unexpected stop order, or testing a background without its actual content.
| Problem | Cause | Practical fix |
|---|---|---|
| No gradient appears | The selected shape may not have an active fill. | Select the shape, confirm its fill, and apply the Gradient tool again. |
| The colors run backward | The drag began at the intended last-color point. | Drag in the opposite direction or adjust the gradient swatch. |
| The blend changes too early | The midpoint is positioned near the start color. | Move the midpoint toward the end color. |
| A CSS stop is rejected | The percentage positions are descending. | Reorder them from lowest to highest; use equal adjacent stops for an intentional hard edge. |
| Text becomes difficult to read | Contrast changes across the gradient. | Test every area under the text and add an overlay or solid fallback if needed. |
| Existing background styles disappear | The copied declaration uses the background shorthand. | Integrate the required properties or apply the gradient through background-image. |
The reliable workflow is to approve the gradient’s direction and colors in Illustrator, reproduce those decisions in CSS when the design moves to the browser, and then test the real component. The generator handles the validated CSS declaration; it does not replace Illustrator’s drawing tools or visual review.
Related reading: How to Make a Mesh Gradient in Illustrator.