asp.net 新闻列表样式代码
作者:
asp.net下新闻列表样式显示代码,使用Repeater控件。
新闻列表:
<div class="news_list">
<asp:Repeater ID="gsxw" runat="server" DataSourceID="GetNewsByType">
<ItemTemplate>
<ul> <li><span>
<%# Convert.ToDateTime(Eval("NTime")).ToShortDateString()%></span><a
href='newdetails.aspx?Type=<%=num %>&&id=<%# Eval("ID") %>&&Page=0'>·<%# Eval("NTitle") %></a></li>
</ul></ItemTemplate>
</asp:Repeater>
</div>
css文件:
.news_list { width:752px; padding:10px 10px;clear:both; padding:0px; line-height:170%;}
.news_list a:hover{ color:#2C4900; font-weight:700;}
.news_list p { float:left; border:1px solid #e4e4e4; padding:4px; margin-right:10px;}
.news_list dl { color:#008804; line-height:25px; font-weight:700;}
.news_list dd { color:#666666; line-height:22px; text-indent:24px;}
.news_list li { color:#0F5300; line-height:28px; text-indent:5px; border-bottom:1px dashed #CFCFCF;}
.news_list a { color:#0F5300;}
.news_list span { color:#A3DC01; float:right;}
复制代码 代码如下:
<div class="news_list">
<asp:Repeater ID="gsxw" runat="server" DataSourceID="GetNewsByType">
<ItemTemplate>
<ul> <li><span>
<%# Convert.ToDateTime(Eval("NTime")).ToShortDateString()%></span><a
href='newdetails.aspx?Type=<%=num %>&&id=<%# Eval("ID") %>&&Page=0'>·<%# Eval("NTitle") %></a></li>
</ul></ItemTemplate>
</asp:Repeater>
</div>
css文件:
复制代码 代码如下:
.news_list { width:752px; padding:10px 10px;clear:both; padding:0px; line-height:170%;}
.news_list a:hover{ color:#2C4900; font-weight:700;}
.news_list p { float:left; border:1px solid #e4e4e4; padding:4px; margin-right:10px;}
.news_list dl { color:#008804; line-height:25px; font-weight:700;}
.news_list dd { color:#666666; line-height:22px; text-indent:24px;}
.news_list li { color:#0F5300; line-height:28px; text-indent:5px; border-bottom:1px dashed #CFCFCF;}
.news_list a { color:#0F5300;}
.news_list span { color:#A3DC01; float:right;}