如何使 div 的高度与旁边的 img 相同?



>我需要帮助使div 与同一 flex 行中旁边的 img 高度相同

这是 HTML

`<div class="about">
<img class="headshot" src="../img/headshot.jpg">
<div class="textbox">here is where my text is</div>
<div>`

我希望 .textbox 的大小与 .headshot 的高度和宽度相同。到目前为止,我的宽度相同,但我无法获得相同的高度。

这是 css:

`.about {
display: flex;
justify-content: center;
align-items: flex-start;
text-align: center;
}
.headshot {
max-height: auto;
max-width: 25%;
}
.textbox {
background-color: hotpink;
width: 25%;
height: auto;
}`

我确信这是一些简单的解决方案,但我一直在为此苦苦挣扎,因此非常感谢任何帮助! :)

尝试为"文本框"类设置height:100%

最新更新