Skip to content

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

Release v0.0.63

github-actions[bot]c45f0af83f53
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index a048017..36daa93 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -8,7 +8,7 @@
"name": "modern-web-guidance",
"source": "./",
"description": "Google Chrome's agent skills collection",
- "version": "0.0.62"
+ "version": "0.0.63"
}
]
}
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 89f7d29..c7acaaa 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "modern-web-guidance",
"description": "Google Chrome's agent skills collection",
- "version": "0.0.62",
+ "version": "0.0.63",
"author": {
"name": "Google Chrome"
}
diff --git a/README.md b/README.md
index a236b10..419f327 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,10 @@
This curated collection of skills, tools, and AI-ready documentation injects Chrome's web platform knowledge directly into your workflow, ensuring your coding agent builds apps that are modern, fast, and secure by default.
-#### Skill Coverage in `v0.0.62`
+#### Skill Coverage in `v0.0.63`
<details>
-<summary><strong>73 web features with implementation guidance from Chrome's experts</strong>: `::backdrop`, `:autofill`, `:has()`, `:not()`, `:user-valid and :user-invalid`, `@starting-style`, `&lt;details>`, `&lt;dialog closedby>`, `&lt;dialog>`, `&lt;link rel="expect">`, `&lt;link rel="preload">`, `AbortController and AbortSignal`, `accent-color`, `Active view transition`, `Anchor positioning`, `blocking="render"`, `calc-size()`, `color-scheme`, `content-visibility`, `Cross-document view transitions`, `Customizable &lt;select>`, `Email, telephone, and URL &lt;input> types`, `enterkeyhint`, `Fetch`, `Fetch priority`, `fetchLater`, `field-sizing`, `font-size-adjust`, `Form-associated WebMCP attributes`, `hidden="until-found"`, `image-set()`, `Individual transform properties`, `inert`, `inputmode`, `Interest invokers`, `interpolate-size`, `Intl.DurationFormat`, `Invoker commands`, `light-dark()`, `linear() easing`, `Long animation frames`, `Masks`, `moveBefore()`, `Mutually exclusive &lt;details> elements`, `Navigation API`, `navigator.modelContext`, `overlay`, `Page visibility state`, `Popover`, `popover="hint"`, `prefers-color-scheme media query`, `prefers-contrast media query`, `prefers-reduced-motion media query`, `Registered custom properties`, `Scheduler API`, `Scroll snap`, `Scroll-driven animations`, `scroll-initial-target`, `scrollbar-color`, `scrollbar-width`, `scrollIntoView()`, `sibling-count() and sibling-index()`, `sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)`, `Speculation rules`, `Temporal`, `text-box`, `text-wrap`, `text-wrap: balance`, `text-wrap: pretty`, `Top-level await`, `transition-behavior`, `View transitions`, `view-transition-class`</summary>
+<summary><strong>74 web features with implementation guidance from Chrome's experts</strong>: `::backdrop`, `:autofill`, `:has()`, `:not()`, `:user-valid and :user-invalid`, `@starting-style`, `&lt;details>`, `&lt;dialog closedby>`, `&lt;dialog>`, `&lt;link rel="expect">`, `&lt;link rel="preload">`, `AbortController and AbortSignal`, `accent-color`, `Active view transition`, `Anchor positioning`, `blocking="render"`, `calc-size()`, `color-scheme`, `Container queries`, `content-visibility`, `Cross-document view transitions`, `Customizable &lt;select>`, `Email, telephone, and URL &lt;input> types`, `enterkeyhint`, `Fetch`, `Fetch priority`, `fetchLater`, `field-sizing`, `font-size-adjust`, `Form-associated WebMCP attributes`, `hidden="until-found"`, `image-set()`, `Individual transform properties`, `inert`, `inputmode`, `Interest invokers`, `interpolate-size`, `Intl.DurationFormat`, `Invoker commands`, `light-dark()`, `linear() easing`, `Long animation frames`, `Masks`, `moveBefore()`, `Mutually exclusive &lt;details> elements`, `Navigation API`, `navigator.modelContext`, `overlay`, `Page visibility state`, `Popover`, `popover="hint"`, `prefers-color-scheme media query`, `prefers-contrast media query`, `prefers-reduced-motion media query`, `Registered custom properties`, `Scheduler API`, `Scroll snap`, `Scroll-driven animations`, `scroll-initial-target`, `scrollbar-color`, `scrollbar-width`, `scrollIntoView()`, `sibling-count() and sibling-index()`, `sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)`, `Speculation rules`, `Temporal`, `text-box`, `text-wrap`, `text-wrap: balance`, `text-wrap: pretty`, `Top-level await`, `transition-behavior`, `View transitions`, `view-transition-class`</summary>
- **[::backdrop](https://webstatus.dev/features/backdrop), [&lt;dialog>](https://webstatus.dev/features/dialog), [overlay](https://webstatus.dev/features/overlay), [Popover](https://webstatus.dev/features/popover), [@starting-style](https://webstatus.dev/features/starting-style), [transition-behavior](https://webstatus.dev/features/transition-behavior)**
- **animate-to-from-top-layer**: Animate elements such as dialogs, popovers, and tooltips as they're entering/exiting the top layer.
@@ -58,6 +58,9 @@ This curated collection of skills, tools, and AI-ready documentation injects Chr
- **browser-ui-color-theme**: Configure built-in browser UI (e.g. scrollbars, form controls, etc) to respect the user's light/dark theme preference.
- **[color-scheme](https://webstatus.dev/features/color-scheme), [light-dark()](https://webstatus.dev/features/light-dark)**
- **component-specific-light-dark-theme**: Create component-specific themes by forcing explicit color schemes on individual UI elements, giving users theme choices that are decoupled from their global operating system preferences
+- **[Container queries](https://webstatus.dev/features/container-queries)**
+ - **fluid-scaling**: Scale items like font size, spacing, and media sizes smoothly based on the parent container's size rather than using fixed breakpoints
+ - **size-aware-styling**: 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.
- **[content-visibility](https://webstatus.dev/features/content-visibility), [hidden="until-found"](https://webstatus.dev/features/hidden-until-found)**
- **defer-rendering-heavy-content**: Reduce rendering times in content-heavy web pages (e.g. pages with long feeds, lots of articles, or complex dashboards), by deferring rendering for any content that is not immediately visible to the user.
- **[Cross-document view transitions](https://webstatus.dev/features/cross-document-view-transitions), [Navigation API](https://webstatus.dev/features/navigation), [View transitions](https://webstatus.dev/features/view-transitions)**
diff --git a/gemini-extension.json b/gemini-extension.json
index 2f33310..3a78aff 100644
--- a/gemini-extension.json
+++ b/gemini-extension.json
@@ -1,7 +1,7 @@
{
"name": "modern-web-guidance",
"description": "Google Chrome's web development agent skills.",
- "version": "0.0.62",
+ "version": "0.0.63",
"author": {
"name": "Google Chrome"
}
diff --git a/package.json b/package.json
index 4ff157c..87b12b2 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "modern-web-guidance",
"displayName": "Modern Web Guidance",
"description": "Curated collection of agent skills for modern web development.",
- "version": "0.0.62",
+ "version": "0.0.63",
"publisher": "GoogleChrome",
"engines": {
"vscode": "^1.90.0",
diff --git a/skills/modern-web/guides/user-experience/fluid-scaling.md b/skills/modern-web/guides/user-experience/fluid-scaling.md
new file mode 100644
index 0000000..2518947
--- /dev/null
+++ b/skills/modern-web/guides/user-experience/fluid-scaling.md
@@ -0,0 +1,77 @@
+## Overview
+
+Fluid scaling allows components to adjust their internal proportions (like font sizes and spacing) based on their current dimensions. This creates a more cohesive design than jumping between fixed breakpoints.
+
+While fluid scaling was historically achieved using viewport units (scaling based on the screen size), modern container query units allow components to scale relative to their parent container instead. This ensures components look good regardless of where they are placed in a layout, promoting better component isolation and reusability.
+
+## Implementation
+
+### 1. Define a container
+
+To use container query units, you must first define a containment context on a parent element.
+
+```css
+.component-wrapper {
+ /* Define the container type. Use 'inline-size' for width-based scaling. */
+ /* You can also use 'size' for both width and height, but it requires explicit sizing. */
+ container-type: inline-size;
+
+ /* Optional: Name the container for specific targeting */
+ container-name: fluid-card;
+}
+```
+
+### 2. Use container query units
+
+Use container query units (`cqi`, `cqb`, etc.) to set sizes relative to the container's dimensions.
+
+* `cqi`: 1% of the container's inline size (width in horizontal writing modes).
+* `cqb`: 1% of the container's block size (height in horizontal writing modes).
+
+**Note**: Container units can be used directly on any property without needing an `@container` query rule. They automatically resolve based on the nearest ancestor with a defined `container-type`.
+
+```css
+.component-title {
+ /* Scale font size based on container width */
+ /* 10cqi means 10% of the container's width */
+ font-size: 10cqi;
+}
+
+.component-body {
+ /* Scale padding based on container width */
+ padding: 5cqi;
+}
+```
+
+### 3. Constrain values with `clamp()`
+
+To prevent sizes from becoming too small or too large, use the CSS `clamp()` function. This impacts the user's ability to zoom or adjust their base font size. To ensure text meets accessibility guidelines, the maximum size must not be more than 2.5 times the minimum size.
+
+```css
+.component-title {
+ /* Clamp font size between 1rem and 2.5rem, scaling with 5% of container width */
+ font-size: clamp(1rem, 5cqi, 2.5rem);
+}
+```
+
+### Fallback strategies
+
+Baseline status for Container queries: Widely available. It's been Baseline since 2023-02-14.
+
+If container queries are not supported by the browser, you should provide a fallback using viewport units or standard media queries.
+
+```css
+.component-title {
+ /* Fallback for browsers that do not support container units */
+ font-size: clamp(1rem, 5vw, 2.5rem);
+}
+
+@supports (font-size: 1cqi) {
+ .component-title {
+ /* Use container units where supported */
+ font-size: clamp(1rem, 5cqi, 2.5rem);
+ }
+}
+```
+
+This fallback ensures that the text still scales, but it will be based on the screen width rather than the component's width. This should be tested to verify it works in your use case.
diff --git a/skills/modern-web/guides/user-experience/size-aware-styling.md b/skills/modern-web/guides/user-experience/size-aware-styling.md
new file mode 100644
index 0000000..706c02f
--- /dev/null
+++ b/skills/modern-web/guides/user-experience/size-aware-styling.md
@@ -0,0 +1,103 @@
+## Overview
+
+Size-aware styling allows components to change their layout or appearance based on the space available to them, rather than the size of the whole screen. This is useful for components like cards or navigation bars that might be placed in different parts of a layout (like a narrow sidebar or a wide main area).
+
+Using container queries is recommended because it makes components truly modular. You do not need to know where the component will live or write complex media queries to handle every possible layout.
+
+## Implementation
+
+### 1. Define the container
+
+MANDATORY: You must first tell the browser which element is the container to be measured.
+
+```css
+.card-container {
+ /* Define the container type. Use 'inline-size' for width-based queries. */
+ /* You can also use 'size' for both width and height, but it requires explicit sizing. */
+ container-type: inline-size;
+}
+```
+
+### 2. Apply styles based on container size
+
+Use the `@container` rule to apply styles when the container reaches a certain size.
+
+```css
+/* Default styles for small containers (stacked layout) */
+.card {
+ display: flex;
+ flex-direction: column;
+ gap: 1rem;
+}
+
+/* Styles for larger containers (side-by-side layout) */
+/* This triggers when the container is wider than 400px */
+@container (min-width: 400px) {
+ .card {
+ flex-direction: row;
+ align-items: center;
+ }
+
+ .card-image {
+ width: 150px;
+ height: 150px;
+ }
+}
+```
+
+### 3. Conditionally show content
+
+You can also use container queries to hide or show extra details when there is more room.
+
+```css
+.card-details {
+ /* Hide extra details by default in small spaces */
+ display: none;
+}
+
+@container (min-width: 600px) {
+ .card-details {
+ /* Show details when there is plenty of room */
+ display: block;
+ }
+}
+```
+
+### Fallback strategies
+
+Baseline status for Container queries: Widely available. It's been Baseline since 2023-02-14.
+
+For browsers that do not support container queries, the best approach is to use a safe default layout (like the stacked vertical layout) and progressively enhance it using media queries if the general screen size allows it.
+
+```css
+/* Default safe stacked layout */
+.card {
+ display: flex;
+ flex-direction: column;
+}
+
+/* Fallback using media queries for older browsers */
+@media (min-width: 600px) {
+ .card {
+ flex-direction: row;
+ }
+}
+
+/* Overwrite with container queries where supported */
+@supports (container-type: inline-size) {
+ @media (min-width: 600px) {
+ .card {
+ /* Reset media query fallback if needed, or let container query handle it */
+ flex-direction: column;
+ }
+ }
+
+ @container (min-width: 400px) {
+ .card {
+ flex-direction: row;
+ }
+ }
+}
+```
+
+This ensures that users on older browsers still get a usable layout, even if it does not adapt perfectly to every specific container width.