ProfK
ProfK

Reputation: 51063

How do I place MVC view label and edit fields on the same line?

How I can get the generated view code below to place the editor-field to the right of the editor-label, on the same row? I don't want to mess with the generated defaults, e.g. remove the divs, as I am still in very early dev and regenerate views quite often.

<div class="editor-label">
    <%: Html.LabelFor(model => model.Suburb) %>
</div>
<div class="editor-field">
    <%: Html.TextBoxFor(model => model.Suburb) %>
    <%: Html.ValidationMessageFor(model => model.Suburb) %>
</div>

Upvotes: 2

Views: 1418

Answers (1)

Jimmy
Jimmy

Reputation: 555

You could try floating both the .editor-label and .editor-field divs left, and having the .editor-label clear left

Upvotes: 3

Related Questions