Heim  >  Artikel  >  Web-Frontend  >  So erstellen Sie eine Nachrichtenliste im DIV+CSS-Layout_CSS/HTML

So erstellen Sie eine Nachrichtenliste im DIV+CSS-Layout_CSS/HTML

WBOY
WBOYOriginal
2016-05-16 12:10:512412Durchsuche

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;
}
  

Hinweis: span muss vorangestellt werden, sonst kommt es zu einem Zeilenumbruch

<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>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn