【发布时间】:2011-12-27 02:20:38
【问题描述】:
我正在尝试将表单元素(搜索表单)和 div 内的 img 链接对齐。我试过做'display:inline',将它们设置在同一行,但不是预期的。我还尝试使用填充或边距调整宽度、浮动和定位,但均无济于事。我将它们放在自己的 div 中,认为这可能会有所帮助,但我也没有取得任何成功。我在这里做错了什么?我知道我的代码在风格上可能看起来很糟糕,但这是他们的容器 div 和里面的代码:
<DIV style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BACKGROUND-COLOR: rgb(127,137,155); MARGIN: 3% auto auto; WIDTH: 670px; HEIGHT: 60px; BORDER-TOP: 1px solid; BORDER-RIGHT: 1px solid" id=links>
<div style="border:0px;width:330px;display:inline;float:left; height:45px; margin-left:4%;margin-top:5%;margin-bottom:5%;"><FORM method=post name=search action=http://dummysearchaddress/search><INPUT name=searchText> <INPUT value="Knowledge Base Search" type=submit> </FORM></div>
<div style="border:0px;width:300px;display:inline;height:55px; margin-left:3%;margin-top:20%;margin-bottom:5%;"><A href="http://dummyimg"><IMG style="BORDER-BOTTOM: rgb(0,0,0) 1px solid; BORDER-LEFT: rgb(0,0,0) 1px solid;BORDER-TOP: rgb(0,0,0) 1px solid; BORDER-RIGHT: rgb(0,0,0) 1px solid;" alt="Technical Support Manual" src="file:///C:/Users/Instructor/Desktop/img/Tech_Manual_button_204%20by%2027.png"></A> </div>
</DIV>
非常感谢任何帮助!
【问题讨论】:
-
您是否尝试过将
vertical-align: middle;放在<img>标记样式中? -
你想要this这样的东西吗?
标签: html css forms image vertical-alignment