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.mdCopy 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
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
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
- Confirm direction (horizontal or vertical) and fade stop percentages.
- Provide the inline CSS snippet and any needed class usage.
- 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-imageand-webkit-mask-imagefor 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%and85%stops. - Strength: change
transparenttorgba(0,0,0,0.2)for softer fades.
Common pitfalls
- Forgetting the
-webkit-mask-imagefallback in Safari. - Expecting masks to work on elements with
overflow: hiddenbut 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
Comments
- …
More skills from this repository
3d-cloth-material
7.2kHelps your agent build realistic woven fabric in Three.js, with thread weave, soft sheen, natural folds, hems and seams.
3d-falling-leaves
7.2kHelps your agent add realistic falling leaves to a 3D scene, with leaves that tumble, drift with the wind and recycle as the camera moves.
3d-four-seasons
7.2kHelps your agent add spring, summer, fall and winter looks to a 3D scene, changing foliage, light, sky and snow without rebuilding it.
3d-high-poly-models
7.2kHelps your agent build detailed 3D models with smooth shapes and believable edges, then prepare lighter versions that run well on the web.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.