Home  >  Article  >  Web Front-end  >  How to create a news list in DIV+CSS layout_CSS/HTML

How to create a news list in DIV+CSS layout_CSS/HTML

WBOY
WBOYOriginal
2016-05-16 12:10:512461browse

CSS code:

.list{
 margin: 0px 10px 20px;
 text-align: left; 
}

.list ul{
 list-style-type: none;
 margin: 0px;
 padding: 0px;
}

.list li{
 background: url(/news/images/line.gif) repeat-x bottom; 
 /*列表底部的虚线*/
 width: 100%; 
}

.list li a{
 color: #777777;
 display: block;
 padding: 6px 0px 4px 15px;
 background: url(/news/images/dot.gif) no-repeat 0 6px;
 /*列表左边的箭头图片*/
}

.list li span{
 float: right;/*使span元素浮动到右面*/
 text-align: right;/*日期右对齐*/
}

.list li a:hover{
 color: #336699;
 background: url(/news/images/dot2.gif) repeat-x bottom;
}
  

Note: span must be placed in front, otherwise a line break will occur

<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>
Statement:
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