DEV Community

Discussion on: React + CSS - Set parent div to the same height as smaller child

Collapse
 
thanhrossi profile image
Tran Thanh

You can use display: grid
jsfiddle.net/bo5wrsm4/2/

Collapse
 
spenglermanfred profile image
spenglermanfred

Thank you for your answer! It looks well with only 4 flexible video-list-items, however my problem is that if I'm adding more video list items (e.g. think if we have 30 videos in a playlist), and fixing the list item height to view a title and subtitle, the video list will overflow, and will push the player the same way.
My goal is to make the video list scrollable with unlimited items in it but still maintain the same height as in your example.

Collapse
 
thanhrossi profile image
Tran Thanh

you can wrap video-list-items with 1 div, and set max-height, overflow-y: auto

Thread Thread
 
spenglermanfred profile image
spenglermanfred

It doesn't work that way. jsfiddle.net/spenglermanfred/mb86d...