Html 如何垂直对齐:将图片与文本居中对齐?

Html 如何垂直对齐:将图片与文本居中对齐?,html,css,Html,Css,这是我的护照 如何将Facebook和Twitter图标与注销文本对齐 CSS: #header_bg { background: #444444; height: 20px; position: absolute; width: 100%; z-index: -1; } #header { background: url("http://i.imgur.com/HXC7Q.png") repeat-x scroll center bottom t

这是我的护照

如何将Facebook和Twitter图标与注销文本对齐

CSS:

#header_bg {
    background: #444444;
    height: 20px;
    position: absolute;
    width: 100%;
    z-index: -1;
}
#header {
    background: url("http://i.imgur.com/HXC7Q.png") repeat-x scroll center bottom transparent;
    height: 30px;
    padding: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 2;
}
<div id="header">
    <div id="header_bg">&nbsp;</div>
    <open style="font-size: 0.7em; color: rgb(255, 255, 255); float: right; margin-top: 7px; margin-right: 75px;">
        <a href="#" target="_blank"><img src="http://i.imgur.com/pYAtH.png"></a>
        <a href="#" target="_blank"><img src="http://i.imgur.com/LnMhg.png"></a>
        <a href="#" style="color: rgb(255, 255, 255);">Logout</a>
    </open>
</div>
HTML:

#header_bg {
    background: #444444;
    height: 20px;
    position: absolute;
    width: 100%;
    z-index: -1;
}
#header {
    background: url("http://i.imgur.com/HXC7Q.png") repeat-x scroll center bottom transparent;
    height: 30px;
    padding: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 2;
}
<div id="header">
    <div id="header_bg">&nbsp;</div>
    <open style="font-size: 0.7em; color: rgb(255, 255, 255); float: right; margin-top: 7px; margin-right: 75px;">
        <a href="#" target="_blank"><img src="http://i.imgur.com/pYAtH.png"></a>
        <a href="#" target="_blank"><img src="http://i.imgur.com/LnMhg.png"></a>
        <a href="#" style="color: rgb(255, 255, 255);">Logout</a>
    </open>
</div>

我将链接放在
span
中,然后应用这些样式

span{
    display:inline-block;
    vertical-align:top;
    padding:0;
}

示例:

删除打开的元素,将a浮动到左侧并应用边距-

最简单的解决方案,不需要更改标记,只需使用:

a,img{vertical-align:middle}
实例:

为了进行更精细的调整,如果执行以下操作,对齐效果会更好:

img{vertical-align:top}
a{vertical-align:middle}

问题是什么。从未遇到过这种元素。把所有的@jason:看来我们很少用它!它应该对每个元素都有效!你的措辞让它看起来像你已经做了!哦,好的。我应该投反对票。不过,我在“乞讨者”大会上发表了评论。如果你指责我投了反对票,我没有。哈哈。没有,埃里克。我不是指责你投了反对票。即使是你或其他人做的,我也活该。让我们休息一下。是的,你是对的。我应该在建议删除“open”之后删除它。我的回答没有遭到任何反对票。谢谢