所以我有这个CSS:
<style type="text/css">
.DontShrink { width: 135px; }
</style>
页面上有3个元素我想要这个宽度(使用这个类)。以下是我将其添加到3个元素的方式:
<%= Html.DropDownListFor(m => m.AmortizationType,
Chatham.Web.Models.Indications.DropDownData.AmortizationTypeDropList(),
new { @class = "DontShrink", propertyName = "AmortizationType", onchange = "UpdateField(this, false);showScheduleFields();" })%>
<%= Html.TextBox("AmortizationComponent_AmortizationEndDate", Model.AmortizationComponent.AmortizationEndDate.HasValue ? Model.AmortizationComponent.AmortizationEndDate.Value.ToString("dd-MMM-yyyy") : "", new { @class = "DontShrink", propertyName = "AmortizationComponent.AmortizationEndDate", onchange = "parseAndSetDt(this); ", dataType = "Date" })%>
<%= Html.TextBoxFor(m => m.AmortizationRate, new { @class = "DontShrink", propertyName = "AmortizationRate", onchange = "UpdateField(this);" })%>
它适用于第三个,但前两个没有任何反应。为什么呢?
答案 0 :(得分:1)
更改为CSS:
.DontShrink { width: 135px !important; }