You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Watching https://www.youtube.com/watch?v=NX_NW6bt6_s it seemed we could remove also h-0 from the parent element, however, if I do that, then the aspect ratio is not always respected.
In short, I have a grid of 3 columns, where the 2nd column spans to 2:
So, ideally, I'd expect the image to appear as a square no matter what the viewport size is, however, check out this screen recording as the screen size gets narrower and narrower:
As you can see, Freud's photo, at some point isn't square anymore!
If I add h-0 to the parent div however, so that the code above becomes:
I had the same issue in a grid (and flex while testing) with a table element but just in Safari. (https://play.tailwindcss.com/Z4HgPoie2d) h-0 just seems to force the browser to calculate the height of an object inside when the browser just isn't smart enough to do so
Hey! This is just a flexbox quirk as mentioned, have to deal with the same stuff when writing vanilla CSS 👍 Nothing for us to really change in the library I don't think so going to close but hopefully that's helpful.
@adamwathan no strong opinions here however, I would like to argue that, although not a tailwind bug per se, IMO tailwind should opt into maintaining the aspect ratio by default (i.e. added h-0 behavior).
Watching https://www.youtube.com/watch?v=NX_NW6bt6_s it seemed we could remove also
h-0
from the parent element, however, if I do that, then the aspect ratio is not always respected.In short, I have a grid of 3 columns, where the 2nd column spans to 2:
So, ideally, I'd expect the image to appear as a square no matter what the viewport size is, however, check out this screen recording as the screen size gets narrower and narrower:
As you can see, Freud's photo, at some point isn't square anymore!
If I add
h-0
to the parentdiv
however, so that the code above becomes:Then it works as advertised:
So, I wonder, is this a bug or am I missing something?
Thanks!
The text was updated successfully, but these errors were encountered: