2013-08-19 279 views
0

我试图在ValidationSummary div(在项目符号列表的左侧)放置一个小图标。图像显示出来,但重复,当我使用:背景图像不显示不重复

background:url(Images/exclamation.png); 

的图像不显示在所有,当我说:

background:url(Images/exclamation.png) no-repeat 12px 30px; 

缺少什么我在这里。

CSS:

.validationsummary 
    { 
    background:url(Images/exclamation.png) no-repeat 12px 30px; 
    border:1px solid #b08b38; 
    width:99%;  
    } 
.validationsummary ul 
{ 
    color:#982b12; 
    background-color:PeachPuff; 
} 
.validationsummary ul li 
{ 
padding:2px 0px 0px 15px; 
font-size:12px; 
} 

ASPX:

<table width="100%"> 
<tr> 
    <td width="100%"> 
    <asp:ValidationSummary ID="vs" runat="server" CssClass="validationsummary" 
    DisplayMode="BulletList" /> 
    </td> 
</tr> 
</table> 

<table width="100%" cellspacing="10px">   
<tr> 
    <td width="11%" align="left"> 
    * Surname 
    </td> 
    <td width="18%" align="left"> 
    <asp:TextBox ID="txtSurname" runat="server" Width="93%"></asp:TextBox> 
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
    ControlToValidate="txtSurname" SetFocusOnError="true" Text="*" ForeColor="Red" 
    Display="Dynamic" ErrorMessage="Surname Is Required"></asp:RequiredFieldValidator> 
    </td> 
</tr> 
</table> 
+0

只需使用“background-repeat:none;”低于“背景”。 – Robert

+1

您是否尝试过没有定位属性的“不重复”?您可能会将其移出屏幕。 – James

+0

另外,屏幕上的验证总结有多大? –

回答

0

背景图像:网址( '图像/ exclamation.png');

background-repeat-x:no-repeat;

background-repeat-y:no-repeat;

+0

该属性不可用。你是指背景重复:repeat-x no-repeat;那也行不通 – Ruby

0

还要定义背景图片的高度

.validationsummary 
    { 
    background:url(Images/exclamation.png) no-repeat 12px 30px; 
    border:1px solid #b08b38; 
    width:99%; 

    height: 200px; /* change it with your requirement */ 


    } 
1

尝试

.validationsummary 
{ 
    background:url(Images/exclamation.png) no-repeat 0 0; 
    border:1px solid #b08b38; 
    width:99%;  
} 

如果是工作,因此定位你的背景。

0
.validationsummary 
{ 
    background-image: url('Images/exclamation.png); 
    background-repeat: no-repeat; 
    background-position: left top; 
    background-size: 16px; 
    padding-left: 20px; /* Depends on the size of the image - 16px + 4px actual padding to indent the text to the right of the image */ 
}