2012-09-28 35 views
1

添加字符在我的CSS我已經定義如下:線通過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> 

但是當我運行該視圖它把一個astericks但然後在下一行標籤上,我希望它們在同一行上。有任何想法嗎?

+0

再次您好...... *星號。對不起,如果這感覺像騷擾。不是我的意圖。此外,您現在正在發送垃圾郵件問題:p – keyser

+1

http://jsfiddle.net/BCMzW/它似乎已經在同一行 – fcalderan

+0

如果您使用*來告訴用戶需要某些東西,那麼這是信息而非樣式。您將遇到可用性問題。 –

回答

2

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

HI現在定義爲這樣

做到這一點的CSS

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

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

調整位置根據您的設計左或頂

+0

在兩者之前還留有一行? – NickP

0

添加display: inline-block;.required.required:before

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