Defer sizing to parent element
I am looking for something that I thought I saw in one of Kevin's (recent) videos. Possibly could have been on a blog though (or State of CSS survey but I went through it again and couldn't find it).
It was a (new I think?) CSS property/value that changed the sizing of an element to be defined by the parent. Say for example you have the following:
Is there a CSS property that defers sizing to the parent
div
such that setting the img
to height: 100%
makes the height of the image match the height of the p
?4 Replies
timestamped to the relevant section
Legend that was it thanks!
If you'd like it broken down a bit more:
https://jeffbridgforth.com/having-figure-match-width-of-contained-image/
Jeff Bridgforth
Jeff Bridgforth
Having figure match width of contained image
Earlier this week, I explored a solution to center an image and caption by making the figure take on the width of the image even when the caption was longer than the image. I wanted the caption to wrap if needed. I asked several other CSS wizards to weigh in.