[英]How to connect a button to an input
How would I make the button connect to the input, there is an awkward gap I don't know how to fix. 我如何使按钮连接到输入,有一个我不知道如何解决的尴尬空白。
#ask {
padding: 10px 10px 10px 6px;
font-size:45px;
background-color:#FAFAFA;
min-width: 400px;
padding: 0 auto;
border-radius: 5px;
}
#button {
text-align:center;
}
</style>
<input id="ask" type="text" placeholder = "Ex: how tall is the gateway arch" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Ex: how tall is the gateway arch'"/>
<input type="image" src="qmb.png" name="saveForm" class="btTxt submit" id="button" height="50.5px" padding = "0px"/>
Use CSS float:left to get input & image side by side. 使用CSS float:left并排获取输入和图像。
input, img {
float:left;
}
Please check this fiddle: http://jsfiddle.net/hnj604pr/ 请检查此小提琴: http : //jsfiddle.net/hnj604pr/
Wrap your input tags in a div like this: 将输入标签包装在div中,如下所示:
<div>
<input....>
<input....>
</div>
This way the browser will align them for you. 这样浏览器将为您调整它们。
You also might want to consider changing your second input tag to use the button or submit tag. 您可能还需要考虑更改第二个输入标签以使用按钮或提交标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.