Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add MengTo/Skills --skill css-alpha-masking -a claude-code
Open on GitHub

What 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-image and -webkit-mask-image so 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-code

2Manually: put the files in place

~/.claude/skills/css-alpha-masking/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/css-alpha-masking/

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

Similar skills

Everything for Frontend and UI →

From the same set148

globe-gl Sets up 3D globe visualizations using globe.gl with WebGL and ThreeJS. Helps configure data layers like points, arcs, and polygons in plain HTML or React. CX Codex +1 1,500installs vantajs Adds animated Vanta.js backgrounds and explains setup for static sites, React, and Next.js. CX Codex +1 1,500installs atmosphere-background A skill for building a dark atmospheric backdrop: vertical light folds drift slowly across the frame and the glow concentrates in one corner or along the lower edge. CX Codex +1 1,500installs editorial-tech Guides code agents to blend magazine typography with technical product UI using asymmetrical grids, mono labels, and restrained accent color. CX Codex +1 1,500installs stitched-full-page-capture Stitches a full-page screenshot from settled viewport slices when a one-shot fullPage capture comes back blank. Built for Framer, WebGL and lazy-loaded pages. CX Codex +1 1,500installs glass-dark-ui Builds dark glassmorphism layouts with frosted surfaces and gradient masked borders. Useful for dark dashboards, hero sections, and cards in HTML, Tailwind, or React. CX Codex +1 1,500installs build-threejs-scroll-worlds Builds scroll-controlled Three.js worlds that stay spatially continuous across authored chapters. Useful for interactive portfolios, product stories, exhibitions, and WebGL explainers. CX Codex +1 1,500installs container-lines This skill adds thin vertical guide lines at the edges of the content container, plus mini corner squares on sections. Useful when a layout feels loose and needs structure. CX Codex +1 1,500installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor