LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. Visual effects

Mask

Also called CSS mask, mask-image, or fade mask

A CSS technique that uses an image or gradient to set how visible each part of an element is, often used to fade edges softly.

const messages = [
  { from: 'Ana', text: 'Did the new build go out?' },
  { from: 'You', text: 'Yes, about ten minutes ago.' },
  { from: 'Ana', text: 'The checkout page looks much faster.' },
  {
    from: 'You',
    text: 'Images load lazily now, and the bundle is 40% smaller.'
  },
  { from: 'Ana', text: 'Nice. Any errors since the deploy?' },
  { from: 'You', text: 'None so far. I will keep an eye on it tonight.' },
  { from: 'Ana', text: 'Thanks! Let me know if anything comes up.' }
];

export function MessageThread() {
  return (
    // The mask is opaque in the middle and transparent at the ends, so messages
    // fade out over the top and bottom 48px instead of being cut off.
    <ul className='flex h-80 w-80 flex-col gap-2 overflow-y-auto py-12 [mask-image:linear-gradient(to_bottom,transparent,black_48px,black_calc(100%-48px),transparent)]'>
      {messages.map((message, index) => (
        <li
          key={index}
          className={`max-w-[75%] rounded-2xl px-3 py-2 text-sm ${message.from === 'You' ? 'self-end bg-blue-600 text-white' : 'self-start bg-muted'}`}
        >
          {message.text}
        </li>
      ))}
    </ul>
  );
}
Fade the top and bottom 48px of the scrolling message list with mask-image: linear-gradient(to bottom, transparent, black 48px, black calc(100% - 48px), transparent), so messages dissolve at the edges instead of being cut off. Include the -webkit-mask-image version for older browsers.

Paste into Layerwise or any AI coding tool.

Mask explained

A mask works like a stencil with shades of transparency. With mask-image, each pixel of the mask controls the element underneath: where the mask is opaque, the element shows; where it is transparent, the element disappears; in between, it fades. A linear-gradient() from black to transparent is the most common mask.

Use it to fade the edges of a scrolling list, carousel, or logo marquee so items dissolve instead of being cut off, which also hints that more content continues. Masks also cut text and icons out of photos and gradients, and they accept SVG and PNG images for any soft-edged shape.

Current browsers support the unprefixed mask-image. Keep -webkit-mask-image alongside it if you support older Safari and Chrome versions, and remember that a mask hides content visually only, so the full content still needs to make sense to screen readers.

Often confused with

Clip-path
Clip-path cuts a hard-edged geometric shape. A mask reads transparency from an image or gradient, so it can fade.

Related terms

All terms

Clip-path

A CSS property that cuts an element to a shape, such as a circle, an inset rectangle, or a polygon, and hides everything outside it.

Marquee

A strip of logos or text that scrolls sideways in an endless loop, often used for "trusted by" rows and announcements.

Gradient text

Text filled with a color gradient instead of a solid color, made by painting a gradient background and clipping it to the shape of the letters.

Grid background

A decorative background of thin grid lines, dots, or stripes, often faded toward the edges, used behind hero sections and product shots.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.

DownloadDownloadRead the docs
LayerwiseLayerwise

Build full-stack web apps in minutes with AI.

Product

  • Features
  • Pricing
  • Download
  • Templates

Solutions

  • AI Website Builder
  • Vibe Coding
  • Personal Software

Resources

  • Documentation
  • Changelog
  • Blog
  • Vibe Coding Glossary
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact

Legal

  • Privacy
  • Analytics Privacy
  • Terms
  • Security
  • Abuse

© 2026 Layerwise. All rights reserved.

Entrances & exits

  • Fade in
  • Slide in
  • Scale in
  • Pop in
  • Blur in
  • Reveal animation
  • Enter and exit animations

Timing & sequencing

  • Duration
  • Delay
  • Keyframes
  • Tweening
  • Stagger
  • Orchestration
  • Fill mode
  • Stepped animation
  • Looping animation
  • Yoyo animation

Easing

  • Easing
  • Linear easing
  • Ease-in
  • Ease-out
  • Ease-in-out
  • Cubic-bezier
  • Asymmetric easing
  • Overshoot easing

Springs & physics

  • Spring animation
  • Stiffness
  • Damping
  • Mass
  • Bounce
  • Velocity
  • Momentum
  • Interruptible animation
  • Rubber-banding

Transforms

  • Translate
  • Scale
  • Rotate
  • Skew
  • 3D flip
  • Perspective
  • Transform origin
  • Origin-aware animation

State transitions

  • Crossfade
  • Morph
  • Shared element transition
  • Layout animation
  • Height auto animation
  • Direction-aware transition
  • Continuity transition
  • Page transition
  • View Transitions API

Scroll effects

  • Scroll reveal
  • Scroll-driven animation
  • Parallax scrolling
  • Scrollytelling
  • Scroll pinning
  • Horizontal scroll section
  • Scroll progress bar
  • Scroll snap
  • Smooth scrolling

Interaction feedback

  • Hover effect
  • Press feedback
  • Ripple effect
  • Shake animation
  • Hold to confirm
  • Drag gesture
  • Drag to reorder
  • Swipe to dismiss
  • Pull to refresh
  • Magnetic button
  • Custom cursor
  • 3D tilt card
  • Spotlight card

Text effects

  • Typewriter effect
  • Text scramble
  • Split text animation
  • Text morph
  • Rotating words
  • Gradient text
  • Shimmer text
  • Number ticker
  • Tabular numbers
  • Underline animation

Loops & ambient motion

  • Marquee
  • Pulse animation
  • Float animation
  • Orbit animation
  • Idle animation
  • Particle background
  • Border beam
  • Confetti
  • Animated gradient

Visual effects

  • Blur
  • Clip-path
  • Mask
  • Before/after slider
  • SVG line drawing
  • Lottie animation

Motion principles

  • Purposeful animation
  • Anticipation
  • Follow-through
  • Squash and stretch
  • Perceived performance
  • Frequency of use
  • Spatial consistency
  • Reduced motion

Animation performance

  • Frame rate (FPS)
  • Jank
  • GPU acceleration
  • will-change
  • Layout thrashing

Layout

  • Hero section
  • Above the fold
  • Sticky header
  • Sidebar
  • Bento grid
  • Card
  • Flexbox
  • CSS Grid
  • Padding vs margin
  • Responsive design
  • Container
  • Masonry layout
  • Split screen
  • Z-index
  • Overflow

Components

  • Button variants
  • Modal
  • Drawer
  • Popover
  • Tooltip
  • Dropdown menu
  • Context menu
  • Toast notification
  • Tabs
  • Segmented control
  • Accordion
  • Carousel
  • Command palette
  • Combobox
  • Toggle switch
  • Checkbox
  • Radio button
  • Date picker
  • Breadcrumb
  • Pagination
  • Infinite scroll
  • Badge
  • Avatar stack
  • Empty state
  • Skeleton screen
  • Spinner
  • Progress bar
  • Data table
  • Stepper
  • Floating label
  • Inline validation
  • Alert banner
  • Tag input

States & patterns

  • Interaction states
  • Focus ring
  • Loading state
  • Optimistic UI
  • Debounce
  • Lazy loading
  • Dark mode
  • Micro-interaction
  • Affordance
  • Undo
  • Drag and drop
  • Keyboard shortcut

Visual styles

  • Glassmorphism
  • Liquid glass
  • Neumorphism
  • Claymorphism
  • Neo-brutalism
  • Skeuomorphism
  • Flat design
  • Mesh gradient
  • Aurora background
  • Grain texture
  • Glow effect
  • Drop shadow
  • Border radius
  • Grid background
  • Typographic hierarchy
  • Accent color
  • Color contrast

Vibe coding & AI

  • Vibe coding
  • Prompt
  • Context window
  • Token
  • AI agent
  • Tool call
  • Hallucination
  • Diff
  • Live preview
  • Checkpoint
  • Git commit
  • Deploy
  • Frontend and backend
  • API
  • Database
  • Rules file
  • MCP
  • Plan mode
  • Visual edit
clip-path
  • MayaShipped it
  • LeoFixed login
  • AvaNew pricing
  • SamReview at 3
  • KaiDeployed
  • MayaShipped it
  • LeoFixed login
  • AvaNew pricing
  • SamReview at 3
  • KaiDeployed
  • MayaShipped it
  • LeoFixed login
  • AvaNew pricing
  • SamReview at 3
  • KaiDeployed
mask-image
  • MayaShipped it
  • LeoFixed login
  • AvaNew pricing
  • SamReview at 3
  • KaiDeployed
  • MayaShipped it
  • LeoFixed login
  • AvaNew pricing
  • SamReview at 3
  • KaiDeployed
  • MayaShipped it
  • LeoFixed login
  • AvaNew pricing
  • SamReview at 3
  • KaiDeployed