Html 由CSS添加的字符后的行

Html 由CSS添加的字符后的行,html,css,vb.net,razor,Html,Css,Vb.net,Razor,在我的CSS中,我定义了以下内容: .required:before { content: "*"; font-weight: bold; color: Red; } 我认为: <div class="editor-label required"> Customer Group </div> <div class="editor-field"> @Html.DropDownLi

在我的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>

客户群
@Html.DropDownList(“GroupId”和“”)
@Html.ValidationMessageFor(函数(模型)model.GroupId)

但是当我运行视图时,它会放一个星号,但是在标签的下一行,我希望它们在同一行。有什么想法吗?

添加
显示:内联块
。必需的
。必需的:在
之前:

.required, .required:before {
    display: inline-block;
}

嗨,现在定义位置如下

做这个css吗

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

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

根据您的设计调整左侧或顶部

再次您好…*星号。抱歉,如果这感觉像是骚扰。不是我的本意。另外,你现在还在发垃圾问题:p似乎已经在同一条线上了。如果你用*告诉用户需要一些东西,那么这是信息而不是风格。您将遇到可用性问题。该问题无法从发布的代码中复制。请提供一个完整的例子来说明这个问题。代码段中不存在的内容导致了问题。是否仍在这两个代码段之前留下一行?