DIV CSS实例教程:一款清新风格的CSS新闻列表制作_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:27:21
Original
1116 people have browsed it

  今天我们说说一款新闻列表的制作。新闻列表是一个网站的重要组成元素。我们会经常遇到它,如何处理他的外观显得尤为重要。这个实例中,我们将标题与日期作单独的浮动,而且在链接的鼠标悬停时,呈现出不同的色彩变化。而且我们控制LI的背景,让其也产生一些交互。总体上的效果还不错。大家可以看看下面的图片:

XHTML代码很简单,就是一个无序列表,不过我们对标题和时间设置了不同的CLASS以方便控制。

我们看下面的CSS代码:

#pagelist {border:4px solid #ccc; padding:10px; width:530px; font-size:12px; list-style-type:none; }
#pagelist li {width:530px; height:30px;}
#pagelist li a .lbt {display:block; width:448px; float:left; text-indent:20px; text-decoration:none; white-space:nowrap; text-overflow:ellipsis; overflow: hidden; display:inline;}
#pagelist li a .ldt {display:block; width:75px; float:right; text-align:center; color:#069; text-decoration:none; display:inline;}
#pagelist li a {width:530px; height:30px; display:block; line-height:30px; color:#666; text-decoration:none; cursor:hand; background:url(20070807_bg.png) no-repeat 0 0;}
#pagelist li a:hover{ color:#03c; text-decoration:none; background:url(20070807_bg.png) no-repeat 0 -30px;}
#pagelist li a:hover .ldt {color:#000;}

  首先我们定义了UL的边框,内边距等相关常用的属性。
  我们设置了LI的宽度为530PX,高度为30px.
  我们对标题和时间进行了单独的设置。相关的属性也很容易理解的。
  我们设置了链接的样式。主要需要注意的是色彩的变化及设置cursor:hand;


http://www.52css.com/attachments/month_0708/20070807.html 点击查看最终的运行效果!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!