文本框和按钮未正确对齐

c# - 文本框和按钮未正确对齐-LMLPHP

大家好,我在这里遇到问题,我的文本框和按钮无法正确对齐。我试图调整包括边距顶部和边距底部的边距,但它们仍然保持完全相同的位置。我对这里出什么问题一无所知。你能帮我么?

Asp.Net:

<asp:Panel HorizontalAlign="center" runat="server">
  <asp:TextBox ID="SearchTextBox" runat="server" placeholder="     Search your item here." CssClass="textbox"></asp:TextBox>
  &nbsp;
  <asp:Button ID="btnSearch" runat="server" OnClick="SearchOnClick" CssClass="button-add" />
</asp:Panel>


CSS:

.textbox {
  border: 1px solid #848484;
  -webkit-border-radius: 30px;
  -moz-border-radius: 30px;
  border-radius: 25px;
  outline: none;
  margin-bottom:10px;
  height: 25px;
  width: 350px;
  background-color: #ede6e6;
}

.button-add {
  background-image: url(../Images/button_searchSmall.gif);
  background-size: auto;
  width: 40px;
  height: 40px;
  background-repeat: no-repeat;
  background-position: center;
  margin-top:20px;
  color: transparent;
  background-color: transparent;
  outline: 1px;
  border: none;
}

最佳答案

display: inline-block; vertical-align: middle;.button-add中添加.textbox参见here

关于c# - 文本框和按钮未正确对齐,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36472586/

10-11 11:51