<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/css-trick-transition-from-height-0-to-auto--wwxc8nnwz" -->

---
title: 🧙‍♂️ CSS trick: transition from height 0 to auto!
description: Learn how to transition from height 0 to auto in CSS using CSS Grid. Avoid fixed heights and use a neat trick with grid-template-rows.
canonical: https://daily.dev/posts/css-trick-transition-from-height-0-to-auto--wwxc8nnwz
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: 🧙‍♂️ CSS trick: transition from height 0 to auto! | daily.dev
og:description: Learn how to transition from height 0 to auto in CSS using CSS Grid. Avoid fixed heights and use a neat trick with grid-template-rows.
og:url: https://daily.dev/posts/css-trick-transition-from-height-0-to-auto--wwxc8nnwz
og:image: https://api.daily.dev/og/posts/WWxc8NNwZ.png
og:image:alt: 🧙‍♂️ CSS trick: transition from height 0 to auto!
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.

# 🧙‍♂️ CSS trick: transition from height 0 to auto!

**[Community Picks](https://daily.dev/sources/community)** · 3 min read · 574 upvotes · 26 comments

## Summary

Learn how to transition from height 0 to auto in CSS using CSS Grid. Avoid fixed heights and use a neat trick with grid-template-rows.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://dev.to/francescovetere/css-trick-transition-from-height-0-to-auto-21de>

## Community discussion

Top comments from developers on daily.dev.

**@osca** · 2 upvotes

> Nice, I thought the max-height was the best solution until now. Thanks!

**@xylobyte** · 1 upvotes

> The last trick with css grid is awesome !

**@ghost** · 0 upvotes

> Thank you very much, I needed this for my project. Thank you!!

**@haissamtariqzaman** · 0 upvotes

> This is a great solution. I have always been using the max height approach.

**@bublicio** · 0 upvotes

> This is amazing!! 🎉

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 1 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#css](https://daily.dev/tags/css)

[View this post on daily.dev](https://daily.dev/posts/css-trick-transition-from-height-0-to-auto--wwxc8nnwz)

```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":"🧙‍♂️ CSS trick: transition from height 0 to auto!","url":"https://daily.dev/posts/css-trick-transition-from-height-0-to-auto--wwxc8nnwz","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/css-trick-transition-from-height-0-to-auto--wwxc8nnwz"},"datePublished":"2023-11-25T15:48:09.065Z","dateModified":"2023-12-07T12:02:45.284Z","description":"Learn how to transition from height 0 to auto in CSS using CSS Grid. Avoid fixed heights and use a neat trick with grid-template-rows.","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b17b914dea7fcee47ebf8a613cc44f1b?_a=AQAEufR","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b17b914dea7fcee47ebf8a613cc44f1b?_a=AQAEufR","isAccessibleForFree":true,"articleSection":"Community Picks","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":"Community Picks","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1655817725/logos/community","url":"https://daily.dev/sources/community"},"commentCount":26,"discussionUrl":"https://daily.dev/posts/css-trick-transition-from-height-0-to-auto--wwxc8nnwz","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":574},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":26}],"keywords":"webdev,css","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Community Picks","item":"https://daily.dev/sources/community"},{"@type":"ListItem","position":3,"name":"🧙‍♂️ CSS trick: transition from height 0 to auto!"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/css-trick-transition-from-height-0-to-auto--wwxc8nnwz","comment":[{"@type":"Comment","text":"Nice, I thought the max-height was the best solution until now. Thanks!","datePublished":"2023-11-29T07:22:57.271Z","url":"https://daily.dev/posts/WWxc8NNwZ#c-fWRUHJWlO","author":{"@type":"Person","name":"Dennis Wiosna","url":"https://daily.dev/osca","image":"https://media.daily.dev/image/upload/s--WZDgQEaK--/f_auto,q_auto/v1695905246/avatars/avatar_sTSdSCK8iQovIYx60X0qy"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"The last trick with css grid is awesome !","datePublished":"2023-12-04T18:36:42.810Z","url":"https://daily.dev/posts/WWxc8NNwZ#c-LIsmbUt7C","author":{"@type":"Person","name":"Nantsa Montillet","url":"https://daily.dev/xylobyte","image":"https://avatars.githubusercontent.com/u/85510137?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Thank you very much, I needed this for my project. Thank you!!","datePublished":"2023-12-07T08:31:09.318Z","url":"https://daily.dev/posts/WWxc8NNwZ#c-uHVMv65Nd","author":{"@type":"Person","name":"Deleted user","url":"https://daily.dev/ghost","image":"https://media.daily.dev/image/upload/s--hNIUzLiO--/f_auto/v1705327420/public/ghost_vlftth"}},{"@type":"Comment","text":"This is a great solution. I have always been using the max height approach.","datePublished":"2023-12-10T09:39:21.596Z","url":"https://daily.dev/posts/WWxc8NNwZ#c-3zC0jpY6w","author":{"@type":"Person","name":"Haissam Tariq Zaman","url":"https://daily.dev/haissamtariqzaman","image":"https://lh3.googleusercontent.com/a/ACg8ocIz0JOScA95h_WSjVSI664qv8NMzUFqkwSoUCNtRrCA-aw=s96-c"}},{"@type":"Comment","text":"This is amazing!! 🎉","datePublished":"2023-12-10T09:38:21.207Z","url":"https://daily.dev/posts/WWxc8NNwZ#c-RKUBPZM3s","author":{"@type":"Person","name":"Dmytro Kadchenko","url":"https://daily.dev/bublicio","image":"https://media.daily.dev/image/upload/s--LfLZOgpr--/f_auto,q_auto/v1698665821/avatars/avatar_qwEgvDECREVgWek8JoLpo"}}]}
```

