此问题已在此处有答案:
One flex/grid item sets the size limit for siblings(6个回答)
2天前关闭。
我想知道是否有可能使左侧列的图像与右侧内容具有相同的高度?我现在面临的问题是,我希望具有响应式弹出窗口,其高度应主要取决于右侧内容,而左侧的图像应与内容具有相同的高度。我错过了什么?
<div class="grid grid-cols-1 items-center bg-purewhite rounded-xl shadow authentication-popup lg:grid-cols-auth-popup lg:max-w-[55rem] lg:w-max svelte-q5aaad opened" style="grid-template-rows: auto !important;">
<div class="w-full h-full relative shrink-0 lg:rounded-l-xl lg:w-fit">
<img class="w-full h-[200px] object-authentication object-cover rounded-t-xl lg:w-[380px] lg:h-full lg:rounded-l-xl lg:rounded-tr-none" style="/*! height: 100% !important; */" src="https://plus.unsplash.com/premium_photo-1677942035529-db39d2a25915?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=928&q=80">
</div>
<div class="flex flex-col grow p-6">
<div class="flex items-center gap-1.5 justify-between">
<p class="text-primary font-bold text-3xl lg:whitespace-nowrap">Please Sign In</p>
<i class="close-pm-delete-confirm-popup fa-solid fa-xmark fa-xl text-secondary cursor-pointer"></i>
</div>
</div>
</div>
1条答案
按热度按时间gcmastyq1#
最好的解决方案是使用flexbox。
参考:https://css-tricks.com/snippets/css/a-guide-to-flexbox/
如果没有固定高度