DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> CSS入門知識 >> CSS詳解 >> CSS制作標簽卡
CSS制作標簽卡
編輯:CSS詳解     
  1. <style type="text/CSS">
  2. body { font-size:14px; font-family:"宋體"}
  3. ol li { margin:8px}
  4. #con { font-size:12px; width:600px; margin:0 auto}
  5. #tags { height:23px; width:400px; margin:0; padding:0; margin-left:10px}
  6. #tags li { float:left; margin-right:1px; background:url(images/tagleft.gif) no-repeat left bottom; height:23px; list-style-type:none}
  7. #tags li a { text-decoration:none; float:left; background:url(images/tagright.gif) no-repeat right bottom; height:23px; padding:0px 10px; line-height:23px; color:#999}
  8. #tags li.emptyTag { width:4px; background:none}
  9. #tags li.selectTag { background-position: left top; position:relative; height:25px; margin-bottom:-2px}
  10. #tags li.selectTag a { background-position: right top; color:#000; height:25px; line-height:25px;}
  11. #tagContent { padding:1px; background-color:#fff; border:1px solid #aecbd4;}
  12. .tagContent { background:url(images/bg.gif) repeat-x; height:350px;  padding:10px; color:#474747; width:576px; display:none}
  13. #tagContent div.selectTag{ display:block}
  14. </style>
  15. </head>
  16. <body>
  17. <h1>標簽示例</h1>
  18. <div id="con">
  19.   <ul id="tags">
  20.     <li><a href="Javascript:void(0)" onmouSEOver="selectTag('tagContent0',this)">標簽一</a></li>
  21. <li class="selectTag"><a href="Javascript:void(0)" onmouSEOver="selectTag('tagContent1',this)">標簽二</a></li>
  22. <li><a href="Javascript:void(0)" onmouSEOver="selectTag('tagContent2',this)">自適應寬度的標簽</a></li>
  23.   </ul>
  24.   <div id="tagContent">
  25.    <div id="tagContent0" class="tagContent">第一個標簽的內容</div>
  26. <div id="tagContent1" class="tagContent selectTag">第二個標簽的內容<p>標簽背景圖1:<img src="images/tagleft.gif" align="top"><br>標簽背景圖2:<img src="images/tagright.gif" align="top"><br>內容漸變背景圖(1象素寬):<img src="images/bg.gif" align="top"></p></div>
  27. <div id="tagContent2" class="tagContent">第三個標簽的內容<p>放大觀看標簽背景圖:<img src="images/tagleft.gif" align="top" width="300" height="100"></p></div>
  28.   </div> 
  29. </div>
  30. <script type="text/Javascript">
  31. function selectTag(showContent,selfObj){
  32. // 操作標簽
  33. var tag = document.getElementById("tags").getElementsByTagName("li");
  34. var tagtaglength = tag.length;
  35. for(i=0; i<taglength; i++){
  36.   tag[i].className = "";
  37. }
  38. selfObj.parentNode.className = "selectTag";
  39. // 操作內容
  40. for(i=0; j=document.getElementById("tagContent"+i); i++){
  41.   j.style.display = "none";
  42. }
  43. document.getElementById(showContent).style.display = "block";
  44.  
  45.  
  46. }
  47. </script>
  48. </body> 
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved