开发者

Styling for the default scaffolding

开发者 https://www.devze.com 2023-02-03 14:30 出处:网络
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)

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号