<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/animating-css-grid-layouts-with-css-anchor-positioning-1ufjfyoc1" -->

---
title: Animating CSS Grid Layouts with CSS Anchor Positioning
description: A technique is demonstrated for animating CSS Grid layout reflows purely with CSS, using Anchor Positioning to anchor each cell's content wrapper to the cell...
canonical: https://daily.dev/posts/animating-css-grid-layouts-with-css-anchor-positioning-1ufjfyoc1
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Animating CSS Grid Layouts with CSS Anchor Positioning | daily.dev
og:description: A technique is demonstrated for animating CSS Grid layout reflows purely with CSS, using Anchor Positioning to anchor each cell's content wrapper to the cell...
og:url: https://daily.dev/posts/animating-css-grid-layouts-with-css-anchor-positioning-1ufjfyoc1
og:image: https://api.daily.dev/og/posts/1UFJfyoc1.png
og:image:alt: Animating CSS Grid Layouts with CSS Anchor Positioning
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Animating CSS Grid Layouts with CSS Anchor Positioning

**[Bram.us](https://daily.dev/sources/bram)** · 3 min read · 15 upvotes · 2 comments

## Summary

A technique is demonstrated for animating CSS Grid layout reflows purely with CSS, using Anchor Positioning to anchor each cell's content wrapper to the cell itself, combined with regular CSS transitions on the inset property. The approach mimics the interruptible resize animation seen on Brave browser's New Tab Page grid, requires no JavaScript, and avoids the queuing issues of View Transitions. Four implementation details are covered: scoping anchor names per cell, aspect-ratio on cells, transitioning inset, and giving explicit dimensions to content divs. A CodePen demo is included, along with a reference to a related Frontend Masters article by Chris Coyier comparing the technique to classic Masonry.js animations.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.bram.us/2026/09/07/animating-css-grid-layouts-with-css-anchor-positioning>

## Questions this post answers

### How can I animate a CSS Grid so it smoothly reorganizes when the viewport resizes, without JavaScript?

Use CSS Anchor Positioning combined with regular CSS transitions. Give each grid cell an anchor-scope and anchor-name (e.g. --a), inject a wrapper div inside the cell set to position: absolute with position-anchor pointing to that anchor and inset: anchor(inside), then add a transition on the inset property so the wrapper smoothly moves as the grid reflows.

_daily.dev surfaces techniques like this for developers exploring CSS-only layout animation._

### Why would I use CSS Anchor Positioning with transitions instead of the View Transitions API to animate a resizing grid?

Anchor Positioning with plain CSS transitions requires no JavaScript at all, while producing animations that are perfectly interruptible: rapidly resizing back and forth redirects tiles mid-flight toward their new positions instead of queuing animation frames or waiting on transition promises to finish, which is how View Transitions typically behave.

_Developers weighing view transitions against anchor positioning can track these comparisons on daily.dev._

### Why do the content divs inside anchored grid cells need explicit width and height set?

Without explicit width and height on the content divs, they would stretch and squeeze awkwardly as they interpolate across the resizing grid during the inset transition. Setting fixed dimensions like width: 6rem and height: 6rem keeps their shape stable while only their position animates via the transitioning inset value.

_daily.dev helps developers debugging CSS anchor positioning quirks find grounded technical detail._

## Community discussion

Top comments from developers on daily.dev.

**@ristotoldsep** · 0 upvotes

> CSS keeps stealing jobs from JavaScript and I fully support this workplace takeover.

**@agustinbarrientos** · 0 upvotes

> Keyboard focus should stay with the item while its wrapper moves between anchors

## Similar posts on daily.dev

- [Responsive CSS Grid Layout with Animation](https://daily.dev/posts/responsive-css-grid-layout-with-animation-gbusjvg4t) · CSS Tip · 34 upvotes · 0 comments
- [Masonry \(with Animation\) in CSS – Master.dev Blog](https://daily.dev/posts/masonry-with-animation-in-css-master-dev-blog-ek1lsjdpl) · Frontend Masters · 12 upvotes · 0 comments
- [Animating CSS position-area with View Transitions](https://daily.dev/posts/animating-css-position-area-with-view-transitions-jsqosahny) · Bram.us · 35 upvotes · 0 comments
- [Transitioning Field Sizing Content With CSS · October 3, 2026](https://daily.dev/posts/transitioning-field-sizing-content-with-css-october-3-2026-gbbw5edae) · Adam Argyle · 3 upvotes · 0 comments

---

Tags: [#css](https://daily.dev/tags/css), [#web-animation](https://daily.dev/tags/web-animation)

[View this post on daily.dev](https://daily.dev/posts/animating-css-grid-layouts-with-css-anchor-positioning-1ufjfyoc1)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Animating CSS Grid Layouts with CSS Anchor Positioning","url":"https://daily.dev/posts/animating-css-grid-layouts-with-css-anchor-positioning-1ufjfyoc1","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/animating-css-grid-layouts-with-css-anchor-positioning-1ufjfyoc1"},"datePublished":"2026-09-07T21:32:22.486Z","dateModified":"2026-09-14T07:09:04.723Z","description":"A technique is demonstrated for animating CSS Grid layout reflows purely with CSS, using Anchor Positioning to anchor each cell's content wrapper to the cell...","image":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","thumbnailUrl":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","isAccessibleForFree":true,"articleSection":"Bram.us","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Bram.us","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/3db2116954be44df873ec24cf0e03d14","url":"https://daily.dev/sources/bram"},"commentCount":2,"discussionUrl":"https://daily.dev/posts/animating-css-grid-layouts-with-css-anchor-positioning-1ufjfyoc1","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":15},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"keywords":"css,web-animation","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Bram.us","item":"https://daily.dev/sources/bram"},{"@type":"ListItem","position":3,"name":"Animating CSS Grid Layouts with CSS Anchor Positioning"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/animating-css-grid-layouts-with-css-anchor-positioning-1ufjfyoc1","comment":[{"@type":"Comment","text":"CSS keeps stealing jobs from JavaScript and I fully support this workplace takeover.","datePublished":"2026-09-08T08:36:07.581Z","url":"https://daily.dev/posts/1UFJfyoc1#c-EWgVGnjBe","author":{"@type":"Person","name":"Risto Tõldsep","url":"https://daily.dev/ristotoldsep","image":"https://media.daily.dev/image/upload/s--i6RRoxB7--/f_auto,pg_1/v1794383659/avatars/avatar_ryDlbifZ1EuRuh3g51ryC?_a=BAMAMiiw0"}},{"@type":"Comment","text":"Keyboard focus should stay with the item while its wrapper moves between anchors","datePublished":"2026-09-10T18:35:45.942Z","url":"https://daily.dev/posts/1UFJfyoc1#c-uHg6jOWnQ","author":{"@type":"Person","name":"Agustin Barrientos","url":"https://daily.dev/agustinbarrientos","image":"https://media.daily.dev/image/upload/s--5ayxQnqn--/f_auto/v1788281802/avatars/avatar_wQYYVe5Tbj0NJ7C7qPoa8?_a=BAMAMicg0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/animating-css-grid-layouts-with-css-anchor-positioning-1ufjfyoc1#faq","mainEntity":[{"@type":"Question","name":"How can I animate a CSS Grid so it smoothly reorganizes when the viewport resizes, without JavaScript?","acceptedAnswer":{"@type":"Answer","text":"Use CSS Anchor Positioning combined with regular CSS transitions. Give each grid cell an anchor-scope and anchor-name (e.g. --a), inject a wrapper div inside the cell set to position: absolute with position-anchor pointing to that anchor and inset: anchor(inside), then add a transition on the inset property so the wrapper smoothly moves as the grid reflows. daily.dev surfaces techniques like this for developers exploring CSS-only layout animation."}},{"@type":"Question","name":"Why would I use CSS Anchor Positioning with transitions instead of the View Transitions API to animate a resizing grid?","acceptedAnswer":{"@type":"Answer","text":"Anchor Positioning with plain CSS transitions requires no JavaScript at all, while producing animations that are perfectly interruptible: rapidly resizing back and forth redirects tiles mid-flight toward their new positions instead of queuing animation frames or waiting on transition promises to finish, which is how View Transitions typically behave. Developers weighing view transitions against anchor positioning can track these comparisons on daily.dev."}},{"@type":"Question","name":"Why do the content divs inside anchored grid cells need explicit width and height set?","acceptedAnswer":{"@type":"Answer","text":"Without explicit width and height on the content divs, they would stretch and squeeze awkwardly as they interpolate across the resizing grid during the inset transition. Setting fixed dimensions like width: 6rem and height: 6rem keeps their shape stable while only their position animates via the transitioning inset value. daily.dev helps developers debugging CSS anchor positioning quirks find grounded technical detail."}}]}
```

