css-alpha-masking
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?
More from mengto/skills
unsplash-asset-images
Use when you need to pick high-quality Unsplash images for product/design assets (avatars, headshots, portraits, large website backgrounds, and abstract wallpapers) and output real Unsplash URLs plus practical instructions for producing the right resolutions and aspect ratios (1:1, 4:5, 3:4, 16:9, 9:16).
65landing-page
Use when designing or rewriting a high-converting landing page (single-offer page) for SaaS/apps/services. Covers structure, layout patterns, conversion strategies, copywriting, SEO/AEO, and common pitfalls.
31gsap
Use when you need to add or debug professional web animations with GSAP (timelines, ScrollTrigger, stagger, transforms) in HTML/CSS/JS/React. Includes patterns for smooth motion, performance, and common pitfalls.
28globe-gl
Use when implementing globe.gl (Globe.GL) for 3D globe data visualization with WebGL/ThreeJS, including setup, data layers (points, arcs, polygons, labels), and integration patterns in plain HTML or React.
27progressive-blur
Create a layered CSS progressive blur (top or bottom) using multiple backdrop-filter masks for depth and softness. Use when asked for “progressive blur”, “gradient blur overlay”, or stepped blur masks that fade from an edge of the viewport.
27pricing-page
Use when designing or rewriting a high-converting SaaS pricing page (structure, plan design, copywriting, SEO/AEO, FAQs, layout patterns, experiments). Includes checklists, templates, and common pitfalls.
25