1

在我的 CSS 中,我定义了以下内容:

.required:before
 {
    content: "*";
    font-weight: bold;
    color: Red;
 }

在我看来,以下几点:

   <div class="editor-label required">
        Customer Group
    </div>
    <div class="editor-field">
        @Html.DropDownList("GroupId", "")
        @Html.ValidationMessageFor(Function(model) model.GroupId)
    </div>

但是当我运行视图时,它会放一个星号,然后在下一行标签上,我希望它们在同一行。有任何想法吗?

4

2 回答 2

2

...................................................

嗨现在定义位置像这样

做这个CSS

.required:before
 {
    content: "*";
    font-weight: bold;
    color: Red;
    position:absolute;
    left:0;
    top:0;
 }

.required{
position:relative;
    padding-left:10px;
}

根据您的设计向左或向上调整

于 2012-09-28T12:00:40.507 回答
0

添加display: inline-block;到两者.required.required:before

.required, .required:before {
    display: inline-block;
}
于 2012-09-28T11:56:04.073 回答