css中,ul和li,做新闻列表,每条新闻前要有图标,请问代码如何编辑?还有就是每天添加的新闻后面有个NEW。

如题所述

第1个回答  推荐于2021-01-23
1.每条新闻前要有图标 不知道图标是不是一样的,还是1.2.3……这种排名形式

·如果图标都是一样的,那就切一个小图标,作为li的背景,也可以设置list-style-image:url();差不多就这两种方法

·如果图标不一样,就把这些图标竖着排到一张图片里,作为ul的背景。然后设置li的行高,让每一行li与每个图标对齐。

2.每天添加的新闻后面有个NEW。
这个要让你们搞后台的同学设置一下,写个判断,获取更新日期与当前日期,如果更新日期=当前日期(天数),那么就显示new的图标。一般的cms都有方法调用的追问

像这样的。每个前面的小图标是一样的。关键是下面有虚线,我这样弄了但是不显示。

.news_ {list-style:url(images/news_li.jpg);;margin: 0 auto;padding:0px;display: block;line-height: 200%;overflow: hidden;}

.news_ li {padding-left: 30px;height: 25px;line-height: 25px;background:url(images/news_li.jpg) no-repeat 3px 7px;list-style: none;overflow: hidden; border-bottom:dotted 1px #626262;}

追答



ul{ width:100px;}
li{ height:22px; line-height:22px; border-bottom:1px dashed #999; background:url(Dot_List.png) no-repeat; background-position:0px 6px; padding-left:10px;}

光盘教学系列
光盘教学系列
光盘教学系列

大概这样子就行了,你换下图片地址,改下background-position值就能出来了

本回答被提问者和网友采纳
第2个回答  2013-01-16
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">

li{
width:50px;
display:block;
border-bottom:1px dashed #CCC;
text-align:center;
background: url(00.png) no-repeat left center;
list-style-position: outside;
line-height:20px;
}

</style></head>
<body>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</body>
</html>
相似回答
大家正在搜