MVC 应用程序中的前端字段对齐
这样我们就有了一个 ASP.NET MVC 2 应用程序。问题是,在我们的前端,很多领域并不喜欢相互配合。我想说,大约 90-95% 的字段显示给用户,我们正在使用 HTML Helpers。我们还主要使用 MVC 2 中发布的新的“for”帮助器,例如 Html.DropDownListFor
看这张图:
它们都使用上面提到的相同的 HTML Helper。这是该特定图片的代码:
<td class="leftRightBorder">
<%= Html.DropDownListFor(m => m.ResetDayComponent.ResetBusinessDayConvention, DropDownData.BusinessDayConventionList(), "", new { propertyName = "ResetDayComponent.ResetBusinessDayConvention", onchange = "UpdateField(this);" })%>
</td>
</tr>
<tr>
<td>Frequency</td>
<td class="leftRightBorder">
<%= Html.DropDownListFor(m => m.FixedComponent.PaymentFrequency, DropDownData.FrequencyDropList(), "", new { propertyName = "FixedComponent.PaymentFrequency", onchange = "UpdateField(this);" })%>
</td>
<td />
<td>Frequency</td>
<td class="leftRightBorder">
<%= Html.DropDownListFor(m => m.FloatingComponent.PaymentFrequency, DropDownData.FrequencyDropList(), "", new { propertyName = "FloatingComponent.PaymentFrequency", onchange = "UpdateField(this);" })%>
</td>
第二个频率是您看到的频率,另一个频率位于这两个下拉列表左侧的表格中。
如何为整个应用程序中的下拉菜单、文本字段等设置通用长度,以便一切看起来一致而不混乱?
So we have an ASP.NET MVC 2 application. The problem is, on our front end, a lot of fields don't like up with each other. I'd say with about 90-95% of the fields displayed to the user we are using HTML Helpers. We also mainly use the new ones released in MVC 2, the "for" helpers, for example, Html.DropDownListFor
Look at this picture:
These are both using the same HTML Helper, mentioned above. Here is the code for that specific picture:
<td class="leftRightBorder">
<%= Html.DropDownListFor(m => m.ResetDayComponent.ResetBusinessDayConvention, DropDownData.BusinessDayConventionList(), "", new { propertyName = "ResetDayComponent.ResetBusinessDayConvention", onchange = "UpdateField(this);" })%>
</td>
</tr>
<tr>
<td>Frequency</td>
<td class="leftRightBorder">
<%= Html.DropDownListFor(m => m.FixedComponent.PaymentFrequency, DropDownData.FrequencyDropList(), "", new { propertyName = "FixedComponent.PaymentFrequency", onchange = "UpdateField(this);" })%>
</td>
<td />
<td>Frequency</td>
<td class="leftRightBorder">
<%= Html.DropDownListFor(m => m.FloatingComponent.PaymentFrequency, DropDownData.FrequencyDropList(), "", new { propertyName = "FloatingComponent.PaymentFrequency", onchange = "UpdateField(this);" })%>
</td>
The second frequency is the one you see, the other is in a table to the left of these two dropdowns.
How can I set a common length for dropdowns, text fields, etc. throughout the app so everything looks consistent and not messy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 级联样式表 定义 HTML 元素的全局样式:
或仅在 < 内设置样式代码>.leftRightBorder
use a cascading style sheet to define global styles for HTML elements:
or to style only within
.leftRightBorder