在DIVCSS排版中新闻列表的制作方法

来源:互联网 发布:黑马程序员 android 编辑:程序博客网 时间:2024/04/30 08:21
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
最终效果:

  • 2005年5月30日 新闻标题01
  • 2005年5月30日 新闻标题02
  • 2005年5月30日 新闻标题03
  • 2005年5月30日 新闻标题04

CSS代码:

 .list{     margin: 0px 10px 20px;     text-align: left;     } .list ul{     list-style-type: none;     margin: 0px;     padding: 0px; } .list li{     background: url(/imagelist/06/31/gu432qq5q695.gif) repeat-x bottom;      /*列表底部的虚线*/     width: 100%;     } .list li a{     color: #777777;     display: block;     padding: 6px 0px 4px 15px;     background: url(/imagelist/06/31/7ei20115t3sv.gif) no-repeat 0 6px;     /*列表左边的箭头图片*/ } .list li span{     float: right;/*使span元素浮动到右面*/     text-align: right;/*日期右对齐*/ } .list li a:hover{     color: #336699;     background: url(/imagelist/06/31/jq1ysff5b0ac.gif) repeat-x bottom; }         

注意:span一定要放在前面,反之会产生换行

 <ul class="list"> <li><span>2005年5月30日 </span><a href="#">新闻标题01</a></li> <li><span>2005年5月30日 </span><a href="#">新闻标题02</a></li> <li><span>2005年5月30日 </span><a href="#">新闻标题03</a></li> <li><span>2005年5月30日 </span><a href="#">新闻标题04</a></li> </ul>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击