我有文本和三个图像以垂直对齐基线。我已经使用垂直对齐属性通过文本底部对齐项目,但它仍然没有正确对齐。 如何通过基线垂直对齐文字和图像?
请参阅透明黑匣子帮助您查看基线问题的屏幕截图。
.container {
font-size: 16px;
}
.ayc_cooperation {
margin: 0 5% 0 5%;
font-size: 0.75rem;
font-weight: 300;
color: #535353;
}
.ayc_cooperation:before {
content: "";
display: table;
clear: both;
}
.ayc_cooperation:after {
content: "";
display: block;
height: 6.5rem;
}
.ayc_cooperation_ini_logo {
float: left;
width: 9.6875rem;
height: 4.5rem;
}
.ayc_cooperation_ini_logo img {
width: 100%;
height: 100%;
}
.ayc_co_container {
float: right;
line-height: 8;
height: 4.5rem;
}
.ayc_co_container img {
max-width: 100%;
max-height: 100%;
}
.ayc_co_container img:first-child {
width: 7.5rem;
}
.ayc_co_container img:nth-child(2) {
width: 8rem;
}
.ayc_co_container img {
margin-right: 2.5rem;
}
.ayc_co {
display: inline-block;
margin-left: 2.5rem;
font-size: 0.75rem;
line-height: 14px;
vertical-align: text-bottom;
}
.ayc_de_lebe_ev_img {
width: 8rem;
}
.ayc_de_lebe_ev_img img {
max-width: 100%;
height: auto;
}
.ayc_de_lebe_img {
width: 7.5rem;
}
.ayc_de_lebe_img img {
max-width: 100%;
height: auto;
}
.ayc_gilead_img {
width: 6rem;
}
.ayc_gilead_img img {
max-width: 100%;
height: auto;
}
<div class="container">
<div class="ayc_co_container">
<div class="ayc_co_text ayc_co">
Eine Kooperation von:
</div>
<div class="ayc_de_lebe_img ayc_co">
<img src="http://presse.bist-du-chris.de/wp-content/themes/ayc_press/assets/media/img/[email protected]" alt="Deutsche Leberstiftung">
</div>
<div class="ayc_de_lebe_ev_img ayc_co">
<img src="http://presse.bist-du-chris.de/wp-content/themes/ayc_press/assets/media/img/deutsche-leberhilfe[email protected]" alt="Deutsche Leberhilfe e.V">
</div>
<div class="ayc_gilead_img ayc_co">
<img src="http://presse.bist-du-chris.de/wp-content/themes/ayc_press/assets/media/img/[email protected]" alt="Gilead Sciences GmbH">
</div>
</div>
</div>
你不能这样做,因为你的形象是一个位图图像将如何在Web浏览器知道在哪里的基准是什么? – Terry
元素本身是对齐的,图像中的文本不是。 CSS不能神奇地将基于文本的元素放置在图像中。您需要编辑图像,以便文本与图像底部对齐。 –