Adapt and Apply a CSS Gradient Background Preset
Admin ·
Start a CSS background from a curated set of colors. A preset makes it easier to compare palettes, then adjust the direction and stops for a specific element size or underlying surface.
Adapt the Harbor Light preset
Choose Ocean under Gradient style, then search for Harbor Light or #287d86. Select Edit on the Harbor Light card. The editor starts at 90 degrees with navy, teal and mint at 0%, 50% and 100%.
Change Angle to 270 and replace Stop 1 color with aqua. The first color now appears on the right. The CSS declaration uses its equivalent #00FFFF, followed by the original teal and mint stops.
background-image: linear-gradient(270deg, #00FFFF 0%, #287D86 50%, #B8E1D8 100%);Open the Gradient Background LibraryW3C CSS linear gradientsW3C CSS named colors
Apply the declaration or downloaded stylesheet
Choose Copy edited CSS to paste the declaration into an existing rule, or download gradient-background.css and give a test element the gradient-background class. Give the element dimensions or content so the browser has room to paint the background.
Open the test page and inspect background-image in developer tools. The browser may serialize HEX colors as RGB functions. Verify the angle and stop order, then check the preview in the dimensions where the background will actually appear.
Open the Gradient Background LibraryW3C CSS linear gradientsW3C CSS background images
Review transparent stops on two surfaces
Choose Minimal and search for Glassine Fade. Edit its blue-to-transparent preset and switch Preview surface between Light and Dark. The surface shows through toward the clear end. The CSS declaration stays the same because it represents only the gradient image.
Set a background color on the final element if its transparent regions need a specific backing. For a different layout, try a radial gradient to move the origin or a conic gradient to rotate the progression around a center.
Open the Gradient Background LibraryW3C CSS background imagesW3C CSS conic gradients
Common questions
Can I reverse the positions without changing the angle?
Yes. Reverse stops mirrors their percentages around 50%. For example, a stop at 20% moves to 80% while the angle stays fixed.
What happens to a customized gradient when I search for another preset?
Search, style and paging affect the gallery. Editing another preset replaces the current settings, so copy or download the current result first if you want to keep it.
Sources
Put it into practice.
- Gradient Background Library
- Gradient Background Library
- CSS gradient generator
- CSS Named Colors Reference