Skip to content

Keep your coding agent up to date with the latest web best practices

Release v0.0.158

github-actions[bot]0c47960e235d
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 4c2ec5e..ab6a76f 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -8,7 +8,7 @@
"name": "modern-web-guidance",
"source": "./",
"description": "Keep your coding agent up to date with the latest web best practices",
- "version": "0.0.157"
+ "version": "0.0.158"
}
]
}
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 069bb86..ade8f83 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "modern-web-guidance",
"description": "Keep your coding agent up to date with the latest web best practices",
- "version": "0.0.157",
+ "version": "0.0.158",
"author": {
"name": "Google Chrome"
}
diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.json
index 069bb86..ade8f83 100644
--- a/.cursor-plugin/plugin.json
+++ b/.cursor-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "modern-web-guidance",
"description": "Keep your coding agent up to date with the latest web best practices",
- "version": "0.0.157",
+ "version": "0.0.158",
"author": {
"name": "Google Chrome"
}
diff --git a/README.md b/README.md
index 196beb1..d59735f 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ Our content is evergrowing, we cover the bleeding edge of the web platform as we
### Core disciplines
-Here's a tiny sampling of the **123 use-case-centric guides**:
+Here's a tiny sampling of the **127 use-case-centric guides**:
* **User Experience**: Smooth and modern visual states: View Transitions, CSS `scrollbar-color` styling, high-contrast adaptation, entry/exit transition animations, parallax scrolling.
* **CSS layout:** container queries (both size and style queries), modern color spaces (`oklch`, `color-mix`) and `subgrid`, text-wrap tuning (`balance`, `pretty`), subgrid, and typography line height trimming (`text-box`)
@@ -36,10 +36,10 @@ Here's a tiny sampling of the **123 use-case-centric guides**:
* **Accessibility & Security**: accessible error announcements, keyboard focus management.
* **Built-in AI**: Leveraging local, on-device client models (native Language Detection, Summarization, and Translation APIs).
-#### Full Skill Coverage (v0.0.157)
+#### Full Skill Coverage (v0.0.158)
<details>
-<summary>Includes expert guidance across <strong>99 modern web features</strong></summary>
+<summary>Includes expert guidance across <strong>100 modern web features</strong></summary>
- [::backdrop](https://web-platform-dx.github.io/web-features-explorer/features/backdrop/)
- [:autofill](https://web-platform-dx.github.io/web-features-explorer/features/autofill/)
@@ -126,6 +126,7 @@ Here's a tiny sampling of the **123 use-case-centric guides**:
- [sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)](https://web-platform-dx.github.io/web-features-explorer/features/trig-functions/)
- [Speculation rules](https://web-platform-dx.github.io/web-features-explorer/features/speculation-rules/)
- [Summarizer](https://web-platform-dx.github.io/web-features-explorer/features/summarizer/)
+- [SVG](https://web-platform-dx.github.io/web-features-explorer/features/svg/)
- [Temporal](https://web-platform-dx.github.io/web-features-explorer/features/temporal/)
- [text-box](https://web-platform-dx.github.io/web-features-explorer/features/text-box/)
- [text-wrap](https://web-platform-dx.github.io/web-features-explorer/features/text-wrap/)
@@ -143,7 +144,7 @@ Here's a tiny sampling of the **123 use-case-centric guides**:
</details>
<details>
-<summary>Covers <strong>123 real-world developer use cases</strong> with production-ready code patterns</summary>
+<summary>Covers <strong>127 real-world developer use cases</strong> with production-ready code patterns</summary>
<h3>accessibility</h3>
@@ -227,6 +228,7 @@ Here's a tiny sampling of the **123 use-case-centric guides**:
- **[carousel-slide-effects](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/carousel-slide-effects.md)**: Create a carousel of slides with images or other visual elements, where each slide animates as they enter/center/exit their scroller. For example, the slides may fade-in/fade-out, rotate, get bigger or smaller, etc.
- **[carousel-snap-highlights](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/carousel-snap-highlights.md)**: Visually highlight the currently snapped non-interactive item in scroll-snapping carousels, galleries, or full-page swipe experiences. For example, expanding a card when snapped, or revealing hidden content.
- **[child-state-based-styling](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/child-state-based-styling.md)**: Build a component that changes its styling based on the state of one of its child elements. For example, a component that renders in light or dark mode based on whether a theme toggle is checked (or not).
+- **[complex-shapes](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/complex-shapes.md)**: Clip elements and their content to any free-form shape, like a symbol, brush stroke, or organic texture for more expressive designs.
- **[component-specific-light-dark-theme](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/component-specific-light-dark-theme.md)**: Force certain elements to be in light mode or dark mode (e.g. code blocks, media players, etc) independently of the page's color-scheme.
- **[consistent-cross-document-transitions](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/consistent-cross-document-transitions.md)**: Ensure critical page state is loaded and stable before initiating a cross-document view transition. This means critical CSS styles are loaded and applied, critical JavaScript is loaded and run, and the HTML visible for the user's initial view of the page has been parsed before the transition runs.
- **[content-based-styling](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/content-based-styling.md)**: Build a component that changes its layout based on whether it contains specific child elements (or not). For example, if the component contains an image, use a multi-column layout, otherwise default to a single-column layout.
@@ -280,8 +282,10 @@ Here's a tiny sampling of the **123 use-case-centric guides**:
- **[scrollability-affordance-hints](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/scrollability-affordance-hints.md)**: Build scroll-shadow overlays, gradient fades, or directional arrow indicators that appear only when there's actually more content to scroll to in that direction.
- **[scrollytelling](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/scrollytelling.md)**: Animate visual properties on a target element — such as fading a backdrop, shifting a background color, or to create scrollytelling experiences — driven entirely by the scrollport position of a completely different element.
- **[search-hidden-content](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/search-hidden-content.md)**: Hide content from view using patterns such as accordions, tabs, and "Read more" sections, while ensuring the hidden text reveals itself during native "Find in page" searches, allows search engine indexing, supports URL fragment deep links, and maintains ARIA accessibility.
+- **[shaped-cutouts](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/shaped-cutouts.md)**: Combine multiple shapes to create complex cutouts or 'knockout' effects in elements, such as adding a notch to an element.
- **[shrinking-header-on-scroll](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/shrinking-header-on-scroll.md)**: Smoothly animate a fixed header or full-page cover on scroll to dynamically shrink, gain shadows, and transform its layout over a predefined scroll distance.
- **[size-aware-styling](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/size-aware-styling.md)**: Build a component whose styles can be conditionally dependent on its own width or height, rather than the width or height of the viewport. For example a card component that can change its layouts depending on how large it is, or a call-to-action button that can conditionally display helper text based on its width.
+- **[soft-edge-content-fade](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/soft-edge-content-fade.md)**: Apply a transparency gradient to content edges to indicate further scrollable areas or to obscure payment-walled text.
- **[stabilize-reactive-state](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/stabilize-reactive-state.md)**: Manage task deadlines or schedules in data-driven views without unexpected side effects from shared mutable state.
- **[stack-drill-down](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/stack-drill-down.md)**: Build full-screen hierarchical navigation that lets users drill down into nested views and swipe or navigate back to return, with browser history kept in sync.
- **[style-parent-with-has](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/style-parent-with-has.md)**: Style parent elements of a form field (e.g. labels or fieldsets) when the field is invalid.
@@ -289,6 +293,7 @@ Here's a tiny sampling of the **123 use-case-centric guides**:
- **[swipe-to-remove](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/swipe-to-remove.md)**: Let users act on items in a list (remove, archive, mark as read, etc.) with a horizontal swipe gesture, so they can process entries quickly without tapping a separate control.
- **[visually-stable-font-fallbacks](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/visually-stable-font-fallbacks.md)**: Define font styles such that text remains readable and visually consistent in the event that there's a swap between the perferred font and one of the fallbacks (or vise versa).
- **[visually-stable-mixed-fonts](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/visually-stable-mixed-fonts.md)**: Define font styles such that text remains readable and visually consistent in situations where multiple fonts are used to render a single block of text.
+- **[visually-texture-content](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/visually-texture-content.md)**: Apply realistic weathering and texture patterns to elements to give them an organic, aged, or physical material appearance.
<h3>webmcp</h3>
diff --git a/gemini-extension.json b/gemini-extension.json
index 069bb86..ade8f83 100644
--- a/gemini-extension.json
+++ b/gemini-extension.json
@@ -1,7 +1,7 @@
{
"name": "modern-web-guidance",
"description": "Keep your coding agent up to date with the latest web best practices",
- "version": "0.0.157",
+ "version": "0.0.158",
"author": {
"name": "Google Chrome"
}
diff --git a/package.json b/package.json
index bd0db0a..8acbd71 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"displayName": "Modern Web Guidance",
"description": "Keep your agent up to date on the latest web best practices.",
"license": "Apache-2.0",
- "version": "0.0.157",
+ "version": "0.0.158",
"publisher": "GoogleChrome",
"engines": {
"vscode": "^1.90.0",
diff --git a/skills/modern-web-guidance/guides/user-experience/complex-shapes.md b/skills/modern-web-guidance/guides/user-experience/complex-shapes.md
new file mode 100644
index 0000000..560b9d7
--- /dev/null
+++ b/skills/modern-web-guidance/guides/user-experience/complex-shapes.md
@@ -0,0 +1,73 @@
+## Overview
+To clip elements to complex, free-form shapes like brush strokes or organic textures, use CSS Masking (`mask-image`). While `clip-path` is excellent for geometric shapes or vector paths, `mask-image` allows you to use images (like PNGs with transparency) or SVGs to define the visible area of an element. This approach is more expressive because it supports semi-transparency, allowing for soft edges and complex textures that are difficult or impossible to achieve with `clip-path`.
+
+## Implementation
+To implement complex shapes using CSS masks:
+
+### Using transparency from an image
+You can use the transparency of an image as a mask, with opaque parts visible and transparent parts hidden. This can be a PNG, SVG, or other image with transparency, or a generated image, like a CSS gradient.
+
+```css
+.shaped-element {
+ /* MANDATORY: Use vendor prefix for wider support in older browsers */
+ -webkit-mask-image: url('mask.svg');
+ -webkit-mask-size: cover; /* Scale mask to cover element */
+ -webkit-mask-repeat: no-repeat; /* Do not tile the mask */
+
+ /* Standard property for modern browsers */
+ mask-image: url('mask.svg');
+ mask-size: cover;
+ mask-repeat: no-repeat;
+}
+```
+
+### Using an SVG element in HTML
+You can also reference a `<mask>` element defined in an inline SVG in your page's HTML. Use `maskContentUnits="objectBoundingBox"` to make the mask scale automatically with the size of the element. This tells the browser to interpret all coordinates inside the mask as fractions from `0` to `1` (like `0.5` for 50%) instead of absolute pixels.
+
+> **Luminance vs. Alpha Masking**: By default, SVG masks use **luminance** (brightness) to determine opacity, where white reveals, black hides, and gray creates semi-transparency. If you want the mask to use the **alpha channel** (transparency) of your SVG shapes instead, you can specify `mask-type: alpha;` in your CSS or `mask-type="alpha"` directly on the SVG `<mask>` element.
+
+```html
+<!-- White areas reveal content, gray creates semi-transparency, black or transparent hides it -->
+<svg width="0" height="0">
+ <defs>
+ <!-- objectBoundingBox scales mask coordinates (0 to 1) with the element's size -->
+ <mask id="custom-shape" maskContentUnits="objectBoundingBox">
+ <!-- Use white shapes to define fully opaque areas -->
+ <circle cx="0.5" cy="0.5" r="0.5" fill="white" />
+ <!-- Use gray shapes to define semi-transparent/faded areas -->
+ <circle cx="0.5" cy="0.5" r="0.25" fill="gray" />
+ </mask>
+ </defs>
+</svg>
+
+<div class="masked-content">
+ <!-- Content to be masked -->
+</div>
+
+<style>
+.masked-content {
+ /* Reference the SVG mask ID */
+ -webkit-mask-image: url(#custom-shape);
+ mask-image: url(#custom-shape);
+}
+</style>
+```
+
+### Fallback strategies
+Baseline status for Masks: Newly available. It's been Baseline since 2023-12-07.
+Supported by: Chrome 120 (Dec 2023), Edge 120 (Dec 2023), Firefox 53 (Apr 2017), and Safari 15.4 (Mar 2022).
+
+If a browser does not support `mask-image` or the prefixed version:
+- The element will not be clipped and will display as a normal rectangle.
+- Ensure the content is still readable and the layout does not break without the mask (progressive enhancement).
+- Optionally, use feature detection to provide a simpler fallback shape with `clip-path`.
+
+```css
+/* Fallback for browsers that do not support masking */
+@supports (not (mask-image: url(x))) and (not (-webkit-mask-image: url(x))) {
+ .shaped-element {
+ /* Use a simple rounded rectangle as fallback */
+ clip-path: inset(5% round 15px);
+ }
+}
+```
diff --git a/skills/modern-web-guidance/guides/user-experience/shaped-cutouts.md b/skills/modern-web-guidance/guides/user-experience/shaped-cutouts.md
new file mode 100644
index 0000000..ea413ae
--- /dev/null
+++ b/skills/modern-web-guidance/guides/user-experience/shaped-cutouts.md
@@ -0,0 +1,146 @@
+## Overview
+CSS Masking allows you to clip an element to a custom shape, such as adding a notch to a card or creating a shaped border. When combining shapes for complex layouts, choose your masking strategy based on the type of content the element contains:
+
+| Masking strategy | Best For | Text Impact |
+| ------------------------------- | ------------------------------- | ------------------------------ |
+| Direct Element SVG Masking | Images, Icons, Decorative shapes, Complex shapes | Not recommended (can crop text) |
+| Adjacent Element SVG Masking | Cards with Text, Crucial content | Text remains fully readable |
+| Pure CSS Gradients | Simple Geometric Shapes | Not recommended (can crop text) |
+
+---
+
+## Implementation
+To implement shaped cutouts:
+
+### Using an SVG Mask
+SVG masks allow you to define shapes that subtract from or add to the visible area using white (reveal) and black (hide) fills.
+
+> **Luminance vs. Alpha Masking**: SVG masks default to **luminance** (brightness) mode, which is why we use `fill="white"` to reveal areas and `fill="black"` to cut them out. If you prefer to use the SVG's transparency (alpha channel) instead of colors, you can set `mask-type: alpha;` in CSS or `mask-type="alpha"` on the SVG `<mask>` element.
+
+#### Direct Element SVG Masking
+When there is no text inside the element to worry about (such as profile avatars, product images, or illustrations), you can apply the SVG mask directly to the element.
+
+Using `maskContentUnits="objectBoundingBox"` inside the SVG mask ensures that the mask scales automatically to the width and height of any element it is applied to.
+
+```html
+<!-- 1. Define the mask in SVG (hidden from view) -->
+<svg width="0" height="0" style="position: absolute;" aria-hidden="true">
+ <defs>
+ <!-- objectBoundingBox makes the mask scale from 0 to 1 along the element's borders -->
+ <mask id="splat-mask" maskContentUnits="objectBoundingBox">
+ <!-- Organic Bezier path defining an artistic paint splat shape -->
+ <path d="M 0.5 0.05 C 0.58 0.05, 0.58 0.21, 0.67 0.18 C 0.76 0.15, 0.79 0.08, 0.85 0.15 C 0.91 0.22, 0.83 0.32, 0.89 0.38 C 0.95 0.44, 1.03 0.45, 0.99 0.55 C 0.95 0.65, 0.82 0.62, 0.8 0.72 C 0.78 0.82, 0.89 0.92, 0.8 0.97 C 0.71 1.02, 0.64 0.88, 0.55 0.93 C 0.46 0.98, 0.44 1.06, 0.35 1.01 C 0.26 0.96, 0.31 0.81, 0.22 0.79 C 0.13 0.77, 0.01 0.88, 0.01 0.77 C 0.01 0.66, 0.16 0.62, 0.14 0.52 C 0.12 0.42, -0.02 0.39, 0.03 0.29 C 0.08 0.19, 0.23 0.27, 0.29 0.19 C 0.35 0.11, 0.3 0.01, 0.4 0.01 C 0.5 0.01, 0.42 0.05, 0.5 0.05 Z" fill="white" />
+ </mask>
+ </defs>
+</svg>
+
+<!-- 2. Apply the mask to the image element -->
+<img src="avatar.jpg" alt="User Profile" class="shaped-avatar">
+
+<style>
+.shaped-avatar {
+ width: 200px;
+ height: 200px;
+ object-fit: cover;
+
+ /* Apply the SVG mask ID with standard and webkit-prefixed properties */
+ -webkit-mask-image: url(#splat-mask);
+ mask-image: url(#splat-mask);
+}
+</style>
+```
+
+#### Adjacent Element SVG Masking
+Apply the mask to an adjacent element rather than the parent element containing text. This ensures that text doesn't get clipped and remains readable.
+
+To solve this, structure your component into a two-part layout:
+1. A **safe, unmasked text container** (`.card-body`) for all readable content.
+2. An **empty decorative `div`** (`.card-accent`) placed next to it, which receives the custom SVG mask.
+
+By assigning both parts the same background color, they visually merge into a single, custom-shaped component.
+
+```html
+<!-- 1. Define the SVG mask (hidden from view) -->
+<svg width="0" height="0" style="position: absolute;" aria-hidden="true">
+ <defs>
+ <!-- Use objectBoundingBox to make the mask scale with the element -->
+ <mask id="accent-stencil" maskContentUnits="objectBoundingBox">
+ <!-- Fill the entire area with white (fully visible) -->
+ <rect width="1" height="1" fill="white" />
+ <!-- Draw a black shape to cut out a concave curve. Extending the path to x=1.1 guarantees it fully clears the right edge, preventing subpixel lines -->
+ <path d="M 1.1,0 C 0.4,0.1 0.4,0.9 1.1,1 L 1.1,0 Z" fill="black" />
+ </mask>
+ </defs>
+</svg>
+
+<!-- 2. Create the unified card layout -->
+<div class="unified-card">
+ <!-- The text-bearing element remains unmasked and perfectly rectangular -->
+ <div class="card-body">
+ <h3>Premium Membership</h3>
+ <p>Get exclusive weekly updates on modern web standards and premium UI designs.</p>
+ </div>
+ <!-- The empty accent element next to it is masked to form the custom shape -->
+ <div class="card-accent"></div>
+</div>
+
+<style>
+.unified-card {
+ display: flex;
+ width: 400px;
+}
+
+.card-body {
+ flex: 1;
+ background-color: #1e293b; /* Elegant slate color */
+ color: #f8fafc;
+ padding: 24px;
+ border-top-left-radius: 16px;
+ border-bottom-left-radius: 16px;
+}
+
+.card-accent {
+ width: 60px;
+ background-color: #1e293b; /* Same background color so they merge visually without seams */
+ border-top-right-radius: 16px;
+ border-bottom-right-radius: 16px;
+
+ /* Reference the SVG mask */
+ -webkit-mask-image: url(#card-accent-mask);
+ mask-image: url(#card-accent-mask);
+}
+</style>
+```
+
+### Using a Single CSS Gradient for Simple Cutouts
+When you only need simple geometric cutouts (such as a semi-circular top notch, side indentations, or straight diagonal cuts), you do not need to write or reference an external SVG. Instead, you can define a CSS radial or linear gradient directly inside the `mask-image` property.
+
+```html
+<div class="gradient-masked-card">
+ <h3>Notched Coupon Card</h3>
+ <p>This card uses a pure CSS radial gradient to cut out a semi-circular notch along its top edge.</p>
+</div>
+
+<style>
+.gradient-masked-card {
+ background: linear-gradient(135deg, #3b82f6, #1d4ed8);
+ color: white;
+ padding: 40px 24px 24px 24px; /* Extra top padding ensures content clears the notch */
+ border-radius: 16px;
+ text-align: center;
+
+ /* radial-gradient places a circle at 50% (horizontal center) and 0% (top edge), cutting out a 20px transparent notch */
+ -webkit-mask-image: radial-gradient(circle at 50% 0%, transparent 20px, black 21px);
+ mask-image: radial-gradient(circle at 50% 0%, transparent 20px, black 21px);
+}
+</style>
+```
+
+## Fallback strategies
+Baseline status for Masks: Newly available. It's been Baseline since 2023-12-07.
+Supported by: Chrome 120 (Dec 2023), Edge 120 (Dec 2023), Firefox 53 (Apr 2017), and Safari 15.4 (Mar 2022).
+
+If a browser does not support `mask-image` or the prefixed version:
+- **For Shaped Images**: The element will degrade gracefully, displaying as a normal rectangular element with its default fallback styles.
+- **For Shaped Cards**: The adjacent decorative `.card-accent` element will remain a solid, unmasked rectangle. Since it shares the same background color as the text container, the entire card will simply render as a standard, clean rectangular container.
+- **Progressive Enhancement**: By keeping text layers outside the mask entirely, your content is guaranteed to remain completely readable, structured, and accessible on older browsers.
diff --git a/skills/modern-web-guidance/guides/user-experience/soft-edge-content-fade.md b/skills/modern-web-guidance/guides/user-experience/soft-edge-content-fade.md
new file mode 100644
index 0000000..db8ebea
--- /dev/null
+++ b/skills/modern-web-guidance/guides/user-experience/soft-edge-content-fade.md
@@ -0,0 +1,62 @@
+## Overview
+To apply a transparency gradient to the edges of a container (e.g., to indicate more content is available to scroll or to fade out text), use CSS Masking with a linear gradient. This approach is superior to using a semi-transparent overlay because it actually fades the content itself, allowing the background to show through naturally without interfering with text selection or pointer events.
+
+## Implementation
+To implement a soft edge fade:
+
+### Fading the bottom edge of a container
+This is useful for indicating that there is more content below in a scrollable area.
+
+```css
+.container {
+ /* Enable scrolling */
+ overflow-y: auto;
+
+ /* MANDATORY: Use vendor prefix for wider support in older browsers */
+ -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
+
+ /* Standard property for modern browsers */
+ mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
+}
+```
+
+### Fading both top and bottom edges
+You can use a single gradient with multiple color stops to fade both edges.
+
+```css
+.dual-fade-container {
+ /* Content is visible between 10% and 90% of the height */
+ -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
+ mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
+}
+```
+
+## Fallback strategies
+Baseline status for Masks: Newly available. It's been Baseline since 2023-12-07.
+Supported by: Chrome 120 (Dec 2023), Edge 120 (Dec 2023), Firefox 53 (Apr 2017), and Safari 15.4 (Mar 2022).
+
+If a browser does not support `mask-image` or the prefixed version:
+- The content will not fade and will display with sharp edges.
+- Ensure the interface is still functional and content is readable without the fade (progressive enhancement).
+- You can use a semi-transparent overlay as a fallback, but be aware it requires knowing the background color and may interfere with text selection unless `pointer-events: none` is used.
+
+```css
+/* Fallback using an overlay for browsers that do not support masking */
+@supports (not (mask-image: linear-gradient(to bottom, black, transparent))) and (not (-webkit-mask-image: linear-gradient(to bottom, black, transparent))) {
+ .container {
+ position: relative;
+ }
+
+ .container::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ height: 20%;
+ /* Fallback assumes a solid background color (e.g., white) */
+ background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
+ pointer-events: none; /* Allow interaction with text underneath */
+ }
+}
+```
diff --git a/skills/modern-web-guidance/guides/user-experience/visually-texture-content.md b/skills/modern-web-guidance/guides/user-experience/visually-texture-content.md
new file mode 100644
index 0000000..7f3d10e
--- /dev/null
+++ b/skills/modern-web-guidance/guides/user-experience/visually-texture-content.md
@@ -0,0 +1,76 @@
+## Overview
+To apply realistic weathering or texture patterns (like grunge, noise, or paper texture) to an element, use CSS Masking (`mask-image`) with a repeating texture image. This allows you to make the content itself appear textured by making parts of it semi-transparent, rather than just overlaying a texture on top. This creates a more realistic physical material appearance.
+
+## Implementation
+To apply a texture pattern:
+
+### Method 1: Using a repeating raster image (Recommended for realistic textures)
+This is the most common method for realistic textures.
+
+```css
+.weathered-element {
+ /* MANDATORY: Use vendor prefix for wider support in older browsers */
+ -webkit-mask-image: url('grunge-pattern.png');
+ -webkit-mask-repeat: repeat; /* Repeat the pattern to fill the area */
+ -webkit-mask-size: 300px; /* Control the scale of the texture */
+
+ /* Standard property for modern browsers */
+ mask-image: url('grunge-pattern.png');
+ mask-repeat: repeat;
+ mask-size: 300px;
+}
+```
+
+### Method 2: Using CSS Gradients for geometric patterns
+You can generate patterns using CSS gradients. This is self-contained and does not require external image files.
+
+```css
+.patterned-element {
+ --checkerboard-gradient:
+ linear-gradient(45deg, #000 25%, transparent 25%),
+ linear-gradient(-45deg, #000 25%, transparent 25%),
+ linear-gradient(45deg, transparent 75%, #000 75%),
+ linear-gradient(-45deg, transparent 75%, #000 75%);
+
+ /* Apply a checkerboard pattern as a mask */
+ -webkit-mask-image: var(--checkerboard-gradient);
+ -webkit-mask-size: 20px 20px;
+ -webkit-mask-position: 0 0, 0 10px, 10px -10px, -10px 0px;
+
+ mask-image: var(--checkerboard-gradient);
+ mask-size: 20px 20px;
+ mask-position: 0 0, 0 10px, 10px -10px, -10px 0px;
+}
+```
+
+### Alpha vs Luminance Masking Modes
+
+By default, CSS masks use `mask-mode: match-source`. This means the browser automatically decides whether to use the **alpha channel** (transparency) or the **luminance** (brightness) of the mask based on what kind of source you provide:
+
+| Mask Source Type | Default Mask Mode | Masking Behavior |
+| :--- | :--- | :--- |
+| **Inline SVG `<mask>` element** | `luminance` | Opacity is determined by the brightness of colors. **White** reveals content, **black** hides it, and **gray** creates semi-transparency. |
+| **Direct Image File** (e.g. PNG, SVG file) | `alpha` | Opacity is determined by transparency. **Opaque** parts reveal content, and **transparent** parts hide it. |
+| **CSS Gradient** | `alpha` | Opacity is determined by transparency. **Opaque** colors (like `black`) reveal content, and **transparent** colors hide it. |
+
+> **Note:** You can explicitly override the default mask mode using the `mask-mode` CSS property (e.g., `mask-mode: luminance;` or `mask-mode: alpha;`).
+
+## Fallback strategies
+Baseline status for Masks: Newly available. It's been Baseline since 2023-12-07.
+Supported by: Chrome 120 (Dec 2023), Edge 120 (Dec 2023), Firefox 53 (Apr 2017), and Safari 15.4 (Mar 2022).
+
+If a browser does not support `mask-image` or the prefixed version:
+- The element will display without the texture (clean and solid fill).
+- Ensure the content is still readable without the texture (progressive enhancement).
+- You can use a background image or an overlay as a fallback to simulate the texture, although it will not affect the transparency of the content itself.
+
+```css
+/* Fallback: Use a background image for browsers without mask support */
+@supports (not (mask-image: url(x))) and (not (-webkit-mask-image: url(x))) {
+ .weathered-element {
+ /* Fallback adds texture on top or behind, depending on implementation */
+ background-image: url('grunge-pattern.svg');
+ background-color: #fff; /* Ensure background is solid if needed */
+ }
+}
+```