我水平有三个文本部分,每个文本都有不同的line-height. 但是,它们应该垂直对齐。
div {
display: flex;
align-items: center;
width: 300px;
background-color: skyblue;
}
p {
font-size: 20px;
font-weight: bold;
margin: 0;
}
p:first-child {
line-height: 1.33;
}
p:nth-child(2) {
line-height: 1.65;
}
<div>
<p>texttext1</p>
<p>texttext2</p>
<p>texttext3</p>
</div>
但是,当我使用align-itemsflex 时,它不起作用。还有其他解决方案吗?