julianc julianc - 5 months ago 30
CSS Question

Field positioning in mvc

I am trying to position these text fields next to each other and have them in the following format: (______) _____ - _____
My main problem is getting them to be next to each other. Does anybody have any suggestions on what I should do?

Here is the code I have so far:

<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>

Answer

It will be something like. You need to do it for all three textboxes:

@Html.TextBox("Something", @Model.text, new {style = "display: inline-block;float:left"})