Skip to content
Skillpedia
Websites & UI (frontend)7.2k · #13418

css-alpha-masking

What it does

This skill gives an AI agent ready-made CSS code for soft fading at the top, bottom, left or right edge of an element. It is for web builders who want images or panels to dissolve smoothly instead of ending in a hard line.

When to use it

  • ✓When you want an image or panel to fade out at its edge rather than end abruptly.
  • ✓When a scrolling strip or text area needs soft edges at the top or bottom.
  • ✓When you need an edge fade that also works in Safari.

Skill link

https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/css-alpha-masking/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/css-alpha-masking/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Make the top and bottom edges of my photo strip fade softly into the background.”

5 new skills a week. 1 minute to read.

How it works

The agent adds a CSS mask with a gradient that goes from transparent to solid and back. It includes both the standard and the Safari version of the property, and the depth of the fade can be tuned.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

CSS Alpha Masking Skill

Workflow

  1. Confirm direction (horizontal or vertical) and fade stop percentages.
  2. Provide the inline CSS snippet and any needed class usage.
  3. Offer small tweaks only (direction, stop positions, colors).

Usage checklist

  • Apply the mask styles directly on the element or in a CSS class.
  • Always include both mask-image and -webkit-mask-image for Safari.
  • Ensure the element has visible content; masks reveal/hide alpha only.

Horizontal (left/right) fade

/* Add this inline CSS to any element */
mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
-webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);

Vertical (top/bottom) fade

/* Add this inline CSS to any element */
mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
-webkit-mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);

Customization knobs

  • Direction: to right, to left, to bottom, to top.
  • Fade depth: adjust 15% and 85% stops.
  • Strength: change transparent to rgba(0,0,0,0.2) for softer fades.

Common pitfalls

  • Forgetting the -webkit-mask-image fallback in Safari.
  • Expecting masks to work on elements with overflow: hidden but no visible content behind.

Questions to ask when specs are missing

  • Which direction should the fade go?
  • How wide should the fade edges be?
  • Is this for images, text, or a container background?
FAQ

What is a CSS mask?

It is a CSS setting that hides parts of an element based on a gradient, so the element fades out instead of being cut off.

Why are there two lines of code?

The skill includes the Safari-specific version as well, because Safari needs it to show the effect.

Why might the fade not show?

The skill notes that the element needs visible content, since a mask only hides or reveals what is already there.

Details

Original description by the author

Apply CSS alpha masking with linear-gradient for horizontal or vertical edge fades (mask-image and -webkit-mask-image). Use when asked for alpha masks, fade edges, or CSS mask gradients.

repo: MengTo/Skills

Popularity

GitHub stars
7.2k
Ranking position
#13418
License
MIT
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills