纯CSS制作的新闻网站中的文章列表
[html]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CSS新闻列表制作</title>
<style type="text/css">
.list{
margin: 0px 10px 20px;
text-align: left;
}
.list ul{
list-style-type: none;
margin: 0px;
padding: 0px;
}
.list li{
width: 100%;
}
.list li a{
color: #777777;
display: block;
padding: 6px 0px 4px 15px;
}
.list li span{
float: right;/*使span元素浮动到右面*/
text-align: right;/*日期右对齐*/
}
.list li a:hover{
color: #336699;
}
</style>
</head>
<body>
<ul class=list>
<li><span>2007年12月21日</span><a href="#" _fcksavedurl="#">新闻标题01</a></li>
<li><span>2007年12月21日</span><a href="#" _fcksavedurl="#">新闻标题02</a></li>
<li><span>2007年12月21日</span><a href="#" _fcksavedurl="#">新闻标题03</a></li>
<li><span>2007年12月21日</span><a href="#" _fcksavedurl="#">新闻标题04</a></li>
</ul>
注意:span一定要放在前面,反之会产生换行
</body>
</html>
[/html]
原文地址:[url=http://wangyesucai.com/sucai/code/200808/26-304.html]http://wangyesucai.com/sucai/code/200808/26-304.html[/url] 楼主,你这样看起来不是很别扭吗?
你都知道在span加float:right;
为什么不在a加上float:left; 很多情况下,SPAN中的内容最好是在A里面,这样会觉得他们是一个整体。当然CSS就就点麻烦了 什么纯CSS,这种还要用什么其他技术吗?
页:
[1]