1 GitHub star = 1 new component.

Star the repo
Typography typographymaskheading

Image Masked Text

Large text with background-clip mask revealing image/video pattern.

Live Preview

Image Masked Text

Usage

Copy and paste this code into your Astro page:

astro
---
import { ImageMaskedText } from 'astro-component-kit';
---

<BackgroundClipMask>Content</BackgroundClipMask>
--- import { ImageMaskedText } from 'astro-component-kit'; --- <BackgroundClipMask>Content</BackgroundClipMask>

Manual Installation

If you are not using the npm package, create a new file and paste the following code: src/components/lib/ImageMaskedText.astro:

astro
---
---
<h1 class="mask-txt"><slot /></h1>
<style>
  .mask-txt { font-size: 8rem; font-weight: 900; background: url('https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&w=1000&q=80'); background-size: cover; background-position: center; -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0; line-height: 1; text-align: center; }
  @media (max-width: 768px) { .mask-txt { font-size: 4rem; } }
</style>
--- --- <h1 class="mask-txt"><slot /></h1> <style> .mask-txt { font-size: 8rem; font-weight: 900; background: url('https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&w=1000&q=80'); background-size: cover; background-position: center; -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0; line-height: 1; text-align: center; } @media (max-width: 768px) { .mask-txt { font-size: 4rem; } } </style>

Quick Info

Category
Typography
Filename
ImageMaskedText.astro
Dependencies
None — pure Astro + CSS
Tags
typographymaskheading