我想要做的是将我的 Logo 与我放置它的标题 div 的底部对齐。我将标题分成 2 个部分标题左侧和标题右侧我只需要在左侧显示站点 Logo 标题的一侧,因此它只需要最大为 350 像素,左边距为 55 像素。我可以轻松地将它对齐到中心,但我不知道出了什么问题以及为什么我无法将它对齐到标题的底部。我尝试了此处论坛中的其他一些步骤,但没有任何效果。
}
header {
background-color: #6699cc;
overflow: hidden;
margin: 0;
background: no-repeat center center cover;
display: block;
border: 0px;
position: relative;
padding: 10px 20px 20px;
}
#header-left {
width: 50%;
vertical-align: bottom;
display: table-cell;
}
<header>
<div id="header-left">
<img src="images/logo.png" alt="Tech World Today" align="bottom"/>
</div>
</header>
最佳答案
将此添加到您的 css:
img {
position: absolute;
bottom: 0;
left: 0;
}
参见 fiddle : https://jsfiddle.net/ocme3jqb/
PS: I added a set height width to your header to show you the effect.
关于html - Img 将底部对齐到 div 的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40627649/