How do I style (CSS) the default scaffolding to have the label and the editor on the same line (the label column have a fixed width)
<div class="editor-label">
@Html.LabelFor(model => model.Price)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Price)
@Html.ValidationMessageFor(m开发者_JAVA技巧odel => model.Price)
</div>
You might need to tweek the widths. The borders are used as guides only while you're developing.
<style type="text/css">
.editor-label {
float: left;
border: 1px solid red;
width: 200px;
margin-bottom: 4px;
}
.editor-field {
float: left;
width: 400px;
border: 1px solid green;
}
.editor-label:before {
clear: left;
}
</style>
精彩评论