首页 > 解决方案 > 图片和下拉菜单不对齐

问题描述

在此处输入图像描述

目前我有一些图片链接和一个下拉菜单。但是,图像高于下拉菜单,我怎样才能让它们对齐?

<a id="nextid" href="javascript:PrePage()"><img src="/graphics/newIcons/previous.png" style = "height: 19px; width: 19px;" title = "Next"></img></a>
<a id="preid" href="javascript:PreCommentPage()"><img src="/graphics/newIcons/previous.png" style = "height: 19px; width: 19px;" title = "Next"></img></a>  
<select name="cars" id="cars">
  <option value="saab">General Comments  -4 comments(s)</option>
</select>

标签: htmlcssstyles

解决方案


您应该vertical-align: middle在 img 标签中使用该属性

#nextid, #preid {
    vertical-align:middle;
}
<a id="nextid" href="javascript:PrePage()"><img src="/graphics/newIcons/previous.png" style = "height: 19px; width: 19px;" title = "Next"></img></a>
<a id="preid" href="javascript:PreCommentPage()"><img src="/graphics/newIcons/previous.png" style = "height: 19px; width: 19px;" title = "Next"></img></a>  
<select name="cars" id="cars">
  <option value="saab">General Comments  -4 comments(s)</option>
</select>


推荐阅读