Search
Star
Feedback
Setup for Free
ยฉ 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Help with simple height animation? - Kevin Powell - Community
KP-C
Kevin Powell - Community
โข
3y ago
โข
2 replies
Dovah
Help with simple height animation?
https://codepen.io/DovahTheKiin/pen/BabqBGE
I want to make second div change it
's height and that first one
, together with it
's content to follow it
, but I want to avoid any hard
-coded values
.
something like this Kevin
's video
:
https://www.youtube.com/watch?v=B_n4YONte5A
I also need for second div to be glued to the bottom of the body all the time
, without absolute units
.
I remember seeing code something like this for
"glued to the bottom
" problem
.
.container
{
display
:
grid
;
grid-template-rows
:
auto
1
fr
;
}
.container
{
display
:
grid
;
grid-template-rows
:
auto
1
fr
;
}
YouTube
Kevin Powell
The simple trick to transition from height 0 to auto with CSS
Animating or transitioning to and from height auto is
, well
, not really possible
(though it is being worked on
!
)
, but luckily
, there is actually a solution using CSS Grid that
โs really easy to implement
!
Links
Keith J
. Grant
โs article on this
(also includes a flexbox solution
)
:
https://keithjgrant.com/posts/2023/04/transitioning-to-height-
.
.
.
Kevin Powell - Community
Join
A friendly place for developers to meet other devs, ask questions, get help, and just have a good time ๐.
36,263
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Help smoothing this simple animation?
KP-C
Kevin Powell - Community / front-end
4y ago
Help with height responsiveness!
KP-C
Kevin Powell - Community / front-end
4y ago
Animation Help
KP-C
Kevin Powell - Community / front-end
3y ago