[英]How to align the span and html dropdown in same line?
I designed the UI like the below. 我设计的用户界面如下所示。
<div class="rightbadger">
<span id="filterRecords">
Number of Results Per Page
<%:Html.DropDownList(
"filterByPageNumber",
Model.ResultPerPage,
null,
new { onchange = "GetResultsPerPage()" }
)
%>
</span>
</div>
CSS: CSS:
.rightbadger { margin-left: 600px;}
But span and dropdown list are not aligned properly in same line.in some browsers are looking good but some of the browsers showing like the below. 但是跨度和下拉列表在同一行中排列不正确。在某些浏览器中看起来不错,但在某些浏览器中显示如下所示。
Just put the CSS 只需把CSS
.filterRecords select{
display:block;
}
If you want to align them vertically you probably should put the text into a separate element, like so: 如果要垂直对齐它们,则可能应将文本放在单独的元素中,如下所示:
<div class="rightbadger">
<div id="filterRecords">
<span>Number of Results Per Page</span>
<%:Html.DropDownList(
"filterByPageNumber",
Model.ResultPerPage,
null,
new { onchange = "GetResultsPerPage()" }
)
%>
</div>
</div>
Then vertical align the 2 element as you want them to be: 然后垂直对齐2元素,如您所愿:
#filterRecords span,
#filterRecords select{ /*or just '#filterRecords *' */
vertical-align: bottom; /*or middle; or top; */
}
You must to set for span and dropdown: 您必须设置跨度和下拉列表:
float:left;
width:300px;
display:block;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.