html - 图片和下拉菜单不对齐
问题描述
目前我有一些图片链接和一个下拉菜单。但是,图像高于下拉菜单,我怎样才能让它们对齐?
<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>
解决方案
您应该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>
推荐阅读
- c# - 在 Linqpad 6 中添加 EF Core 5 上下文会引发无法加载文件或程序集“System.Runtime”错误
- python - 从文本文件python读取列
- flutter - 未处理的异常:DioError [DioErrorType.DEFAULT]:将对象转换为可编码对象失败:“DateTime”实例
- c++ - c++:以编程方式初始化 constexpr std-2DArray
- python-3.x - 在比较之前字符串会自动转换为浮点数吗
- reactjs - React Router V5 HashRouter 不存储历史记录
- spring-boot - Spring Boot JpaRepository 时间复杂度问题
- android - 深层链接打开错误的应用程序(即时应用程序,未安装的应用程序)
- java - Windows 上的 jlink 失败 w“错误:重复条目!”
- c# - 使用 Dockerfile (Visual Studio) 设置 .xml 文件的相对路径