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

4 回答 4

1

尝试

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

如果它有效,请相应地定位您的背景。

于 2013-08-19T10:30:12.553 回答
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 */
}
于 2014-04-09T09:20:22.853 回答
0

还要定义背景图像的高度

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

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


  }
于 2013-08-19T10:06:21.757 回答
0

background-image:url('图片/exclamation.png');

背景-重复-x:不重复;

背景-重复-y:不重复;

于 2013-08-19T10:03:29.450 回答