如何将按钮连接到输入

How to connect a button to an input

我如何让按钮连接到输入,有一个尴尬的差距我不知道如何修复。

  #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"/>

将您的输入标签包装在 div 中,如下所示:

<div>
    <input....>
    <input....>
</div>

这样浏览器会为您对齐它们。

您可能还想考虑更改第二个输入标签以使用按钮或提交标签。

使用CSS float:left 并排获取输入和图像。

input, img {
    float:left;
}

请检查这个fiddle:http://jsfiddle.net/hnj604pr/