flexbox - 如何使 div 与它旁边的 img 高度相同?
问题描述
我需要帮助使 div 的高度与它旁边的 img 在同一 flex 行中的高度相同
这是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%
“文本框”类。
推荐阅读
- maven - 来自 maven 和 Jenkins 的 SonarQube 分析有不同的结果
- amazon-web-services - 需要 AWS API 网关手动部署吗?
- c++ - 具有不同模板类型的子类的多态性
- makefile - 确保从特定目录调用 make
- wordpress - 用 wordpress 重写规则
- javascript - 需要使用 jQuery / 不使用 AJAX / 提交 Add to Cart 表单
- jenkins - 我想通过使用扩展的选择参数来选择多个选择,并且从这些选择中我想通过传递一个刺匹配来运行作业
- r - 当数据是整洁(长)格式时,使用 ggplot 制作许多散点图
- python-2.7 - 检查一组索引中的行是否重复并重建
- html - 评估然后从 MailApp 电子邮件发送 HTML