<style>
.LiSpecStyle
{
float: left;
width: 668px;
margin: 10px 0 10px 0;
height: 1px;
font-size: 0;
border-bottom: 1px dashed #ccc;
}
.LiStyle
{
float: left;
width: 668px;
margin: 0px;
height: 0px;
font-size: 0;
display:none;
}
</style>
<ul class="list_main">
<asp:Repeater ID="RepeaterNew" runat="server">
<ItemTemplate>
<li style="background-position:left 8px"><span class="date" >
<%#Convert.ToDateTime(Eval("CreateDate")).ToShortDateString()%></span><a href="NewsInfo.aspx?NewID=<%#Eval("ID").ToString() %>"><%#CommonFQW.SubstringByte(Eval("Title").ToString(),0,60)%></a></li>
<div class="<%#ControlRepeaterStyle((int)Container.ItemIndex) %>">
</div>
</ItemTemplate>
</asp:Repeater>
</ul>
c#
public string ControlRepeaterStyle(int index)
{
if ((index+1) % 5 == 0 && index!=0)
{
return "LiSpecStyle";
}
else
{
return "LiStyle";
}
}
如果正常解析,div实在里面的,所以li前面的图标总是在中间,在加了style="background-position:left 8px"的情况下才能实现,li图标离顶部8px,不管li有几行