PC6下载站 ●
分类分类
关注+2009-12-18作者:
今天花了点儿时间,琢磨了一下如何简洁的实现网页上常用的栏目。就是下面的这种东西,我称之为栏目,不知道别人叫它什么:
以下是我的html文件及css文件,可以便捷地进行样式切换。如果谁有更简洁的方式,请留言指教。 HTML文件:
<?xml version="1.0" encoding="UTF-8" ?> <!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=UTF-8" /> <title>Insert title here</title> <link href="column.css" style="text/css" rel="stylesheet"/> <script type="text/javascript"> var gIndex = 1; function doSwitch(){ var e = document.getElementById('info'); e.className = e.className.split(' ')[0]+' s'+(gIndex%3+1); gIndex++; } </script> </head> <body> <ul class="column s1" id="info"> <li class="title"><div>信息公示</div></li> <li><a href="#">隔壁老王</a></li> <li><a href="http://wallimn.javaeye.com">http://wallimn.javaeye.com</a></li> <li><a href="#">很长文本自动截断,一切皆有可能,一切皆有可能,一切皆有可能,一切皆有可能</a></li> <li class="tail"><a href="#">更多...</a></li> </ul> <br/> <input type="button" value="样式切换" onclick="doSwitch()" /> </body> </html>
CSS文件:
相关文章
更多+相同厂商
热门推荐
点击查看更多
说两句网友评论