JS+CSS实现隔行换色
source link: https://blogread.cn/it/article/810?f=hot1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
JS+CSS实现隔行换色
以下是引用片段:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>链接背景色隔行显示</title>
</head>
<style>
.mytable {border-collapse:collapse;border:solid #6AA70B;border-width:0px 0 0 0px;width:50%;}
.mytable ul li {padding-top:5px;text-indent:2em;list-style:none;background:url(http://www.blueidea.com/img/common/new_flash.gif) 3px 50% no-repeat;border-bottom:#6AA70B 1px dotted ;font-family: "Verdana,宋体";font-size: 12px;color:#008000;text-align:left;height:25px;}
.mytable ul li.t1 {background-color:#EFFEDD;}/* 第一行的背景色 */
.mytable ul li.t2{background-color:#ffffff;}/* 第二行的背景色 */
.mytable ul li.t3 {padding-top:5px;text-indent:2em;list-style:none;background:url(http://www.blueidea.com/img/common/new.gif) #D2FCA0 3px 50% no-repeat;border-bottom:#6AA70B 1px dotted ;font-family: "Verdana,宋体";font-size: 12px;color:#008000;text-align:left;height:25px;}/* 鼠标经过时的背景色 */
</style>
<body>
<div id=tab>
<ul>
<li><a href="#">这个是第1行的文字,大家看清楚了</a></li>
<li><a href="#">这个是第2行的文字,大家看清楚了</a></li>
<li><a href="#">这个是第3行的文字,大家看清楚了</a></li>
<li><a href="#">这个是第4行的文字,大家看清楚了</a></li>
<li><a href="#">这个是第5行的文字,大家看清楚了</a></li>
<li><a href="#">这个是第6行的文字,大家看清楚了</a></li>
<li><a href="#">这个是第7行的文字,大家看清楚了</a></li>
<li><a href="#">这个是第8行的文字,大家看清楚了</a></li>
<li><a href="#">这个是第9行的文字,大家看清楚了</a></li>
</ul></div><script type="text/javascript">
</script>
</body>
</html>
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK