【发布时间】:2018-01-27 18:18:53
【问题描述】:
最右边带有“ABC”的框和左/下边框正被向下压低到旁边渐变图像高度的一半。我知道很多高度/等没有意义,但我已经将它们全部删除,问题仍然存在。这里有什么指导吗?
HTML:
<div className="thing">
<img src="https://unsplash.it/75/90/?blur" alt="hey there" className="thingImage" />
<div className="content">
<span className="thingName">Jibber Jabb Super Long Title of a Movie or Thing Here</span><br/>
<span className="thingRanks">
Rank1: 1<br/>
Rank2: 2<br/>
Rank3: 2
</span>
</div>
<div className="thingMeta">
<img src="https://unsplash.it/30/30/?blur" alt="name" className="thingIcon" />
<span className="thingAbbrev">ABC</span>
</div>
</div>
(“className”来自 React,如果你不熟悉 React,就读作“class”)
CSS:
.thing{
border: 1px solid #ccc;
width: 564px;
min-height: 68px;
padding: 10px;
font-family: "Helvetica", arial, sans-serif;
font-size: 14px;
line-height: 18px;
display: flex;
}
.thingImage{
border-radius: 5px;
margin-right: 10px;
}
.thingName{
font-weight: bold;
margin-right: 0.3em;
}
.thingMeta{
margin-left: auto;
align-self: flex-start;
height: 35px;
}
.thingAbbrev{
border-bottom: medium solid #000000;
border-left: medium solid #000;
align-self: flex-start;
padding-left: 5px;
padding-bottom: 5px;
margin-left: 10px;
width: 30px;
}
.thingIcon{
height: 30px;
}
对我来说,这个项目的主要重点是学习 React,在这里使用 Flexbox 对我来说只是一个奖励。在此先感谢,非常感谢任何帮助或指导!
【问题讨论】:
标签: css flexbox vertical-alignment