国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

CSS實例教程:制作網頁特殊產品列表

2024-07-11 08:24:25
字體:
來源:轉載
供稿:網友

我們通常的做法是,把日期寫在span標簽里,然后把span標簽寫在li里,css定義span(float:right),讓span浮動在列表的右邊。
近日,被同事問及一個產品列表的做法怎么實現?一個產品列表,每個產品列表后面跟一個button,這些button居右對齊。

其實這個效果跟新聞列表是類似的,我們常常需要做這樣的新聞列表效果:

我們通常的做法是,把日期寫在span標簽里,然后把span標簽寫在li里,css定義span(float:right),讓span浮動在列表的右邊。
css部分:
body { font-size:12px}
ul { width:400px; margin:0; padding:0; list-style:none}
.newslist { line-height:20px; padding:5px 0; color:#333; border-bottom:1px dashed #ccc}
.newslist span { color:#888; float:right; text-align:right}
a { color:#333; text-decoration:none}
a:hover { color:blue; text-decoration:underline}
html部分:
<ul>
<li class="newslist">·<a href="#">10%無責賠償仍存 交強驚</a><span>2008-11-28</span></li>
</ul>
我們一般的邏輯做法都是把<span>日期</span>寫在新聞列表的后面。其實不然,我們應該把<span>日期</span>放在新聞列表的前面。至于為什么要這樣做,我還沒找到很好的解釋。

正確的做法:
<ul>
<li class="newslist"><span>2008-11-28</span>·<a href="#">10%無責賠償仍存 交強驚</a></li>
</ul>
全部代碼:
<!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>無標題文檔</title>
<style type="text/css">
<!--
body { font-size:12px}
ul { width:400px; margin:0; padding:0; list-style:none}
.newslist { line-height:20px; padding:5px 0; color:#333; border-bottom:1px dashed #ccc}
.newslist span { color:#888; float:right; text-align:right}
a { color:#333; text-decoration:none}
a:hover { color:blue; text-decoration:underline}
-->
</style>
</head>
<body>
<ul>
<li class="newslist"><span>2008-11-28</span>·<a href="#">10%無責賠償仍存 交強驚</a></li>
<li class="newslist"><span>2008-11-28</span>·<a href="#">百張奧運開幕式門票贈送大揭曉!</a></li>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南郑县| 青冈县| 斗六市| 大兴区| 丰县| 德令哈市| 盐城市| 淳安县| 桐梓县| 喜德县| 汉沽区| 枝江市| 乐平市| 漯河市| 广州市| 施甸县| 蒙山县| 涡阳县| 湖州市| 巴林右旗| 齐齐哈尔市| 浪卡子县| 平安县| 深圳市| 蒲江县| 梁平县| 三都| 泰州市| 黎川县| 太康县| 安阳市| 南郑县| 平远县| 湘潭市| 兰考县| 晋中市| 临沧市| 宣化县| 阿荣旗| 阿克| 阿荣旗|