如何设置默认支架的样式(CSS),以使标签和编辑器在同一行上(标签列的宽度固定)

    <div class="editor-label">
        @Html.LabelFor(model => model.Price)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Price)
        @Html.ValidationMessageFor(model => model.Price)
    </div>

最佳答案

您可能需要调整宽度。边框仅在开发时用作参考。

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

关于css - 默认脚手架的样式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4626857/

10-12 12:21
查看更多