css-alpha-masking — Claude Code skill: CSS masks
This skill adds CSS alpha masks with gradient edge fades. Use it when an image, text block, or container needs a horizontal or vertical fade.
npx skills add MengTo/Skills --skill css-alpha-masking -a claude-codeWhat css-alpha-masking does
css-alpha-masking applies horizontal or vertical edge fades with linear-gradient. It uses both mask-image and -webkit-mask-image, so the same pattern can be placed directly on an element or in a CSS class.
The skill asks for the fade direction and stop positions, then returns a CSS snippet with class usage when needed. You can adjust the direction, fade depth, and transparency. The element must have visible content because the mask changes alpha rather than drawing a background. Keep -webkit-mask-image for Safari, so its presence is worth checking before shipping.
What it helps with
- add a horizontal edge fade
- create a vertical container fade
- apply a CSS mask to text or an image
- keep the mask syntax compatible with Safari
Example prompts for the agent
- Add a horizontal edge fade to this image with a CSS mask.
- Create a vertical fade for this container and put the styles in a CSS class.
- Adjust
mask-imageand-webkit-mask-imageso the fade area is narrower.
How to install css-alpha-masking
1Skills CLI (Vercel)
npx skills add MengTo/Skills --skill css-alpha-masking -a claude-code2Manually: put the files in place
~/.claude/skills/css-alpha-masking/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/css-alpha-masking/
1Skills CLI (Vercel)
npx skills add MengTo/Skills --skill css-alpha-masking -a codex2Manually: put the files in place
.agents/skills/css-alpha-masking/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add MengTo/Skills --skill css-alpha-masking -a cursor2Manually: put the files in place
.cursor/skills/css-alpha-masking/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install MengTo/Skills css-alpha-masking2Manually: put the files in place
.github/skills/css-alpha-masking/SKILL.md1Skills CLI (Vercel)
npx skills add MengTo/Skills --skill css-alpha-masking -a gemini-cli2Platform CLI
gemini skills install https://github.com/MengTo/Skills --path agent-skills/web-design/css-alpha-maskingManually: put the files in place
.devin/skills/css-alpha-masking/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add MengTo/Skills --skill css-alpha-masking -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about css-alpha-masking
How do I install css-alpha-masking in Claude Code?
Run npx skills add MengTo/Skills --skill css-alpha-masking -a claude-code, then run npx skills add MengTo/Skills --skill css-alpha-masking -a claude-code again. Check ~/.claude/skills/css-alpha-masking/SKILL.md afterward.
What does css-alpha-masking do?
The skill creates CSS masks with linear-gradient for horizontal or vertical edge fades. It provides the mask properties and small adjustments for direction, stops, and transparency.
What should I account for when using the mask in Safari?
Include both mask-image and -webkit-mask-image for Safari. The masked element also needs visible content because the mask changes its alpha channel.
Source text
SKILL.md · MIT
--- name: css-alpha-masking description: 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. --- # 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 ```css /* 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 ```css /* 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?
© MengTo · MIT · MengTo/Skills