mvc中的字段定位
Field positioning in mvc
我试图将这些文本字段并排放置,并采用以下格式:
(______) _____ - _____
我的主要问题是让它们彼此相邻。有人对我应该做什么有什么建议吗?
这是我目前的代码:
<label style="margin: 5px" id="lblPhoneNumber">Phone Number (optional)</label>
<p>
@Html.ValidationMessageFor(model => model.Pharmacy.PhoneNumber)
@Html.TextBoxFor(model => model.Pharmacy.AreaCode, new { style="width:3em", maxlength=3})
@Html.TextBoxFor(model => model.Pharmacy.PhoneNumberFirstThree, new { style="width:3em", maxlength = 3 })
@Html.TextBoxFor(model => model.Pharmacy.PhoneNumberLastFour, new { style="width:4em", maxlength = 4 })
</p>
会是这样的。您需要为所有三个文本框执行此操作:
@Html.TextBox("Something", @Model.text, new {style = "display: inline-block;float:left"})
我试图将这些文本字段并排放置,并采用以下格式:
(______) _____ - _____
我的主要问题是让它们彼此相邻。有人对我应该做什么有什么建议吗?
这是我目前的代码:
<label style="margin: 5px" id="lblPhoneNumber">Phone Number (optional)</label>
<p>
@Html.ValidationMessageFor(model => model.Pharmacy.PhoneNumber)
@Html.TextBoxFor(model => model.Pharmacy.AreaCode, new { style="width:3em", maxlength=3})
@Html.TextBoxFor(model => model.Pharmacy.PhoneNumberFirstThree, new { style="width:3em", maxlength = 3 })
@Html.TextBoxFor(model => model.Pharmacy.PhoneNumberLastFour, new { style="width:4em", maxlength = 4 })
</p>
会是这样的。您需要为所有三个文本框执行此操作:
@Html.TextBox("Something", @Model.text, new {style = "display: inline-block;float:left"})