CSS + JQuery achieves Tabs effect, click to change the background color (excluding images ),
1. Html code
1 <body> 2 <div id = "box"> 3 <ul id = "tab_nav"> 4 <li class = "nonblank"> purchase bidding documents </li> 5 <li class = "blank"> </li> 6 <li class = "nonblank"> legal authorization </li> 7 <li class = "blank"> </li> 8 <li class = "nonblank"> bank Qualification Certificate </li> 9 <li class = "blank"> </li> 10 <li class = "nonblank"> View archives </ li> 11 <li class = "blank"> </li> 12 <li class = "nonblank"> confirmation of division of bids </li> 13 <li class = "blank"> </li> 14 <li class = "nonblank"> use seal </li> 15 <li class = "blank"> </li> 16 <li class = "nonblank"> purchase </li> 17 </ul> 18 </div> 19 </body>
2. CSS code
<style type="text/css"> #box { height: 300px; margin-top: 200px; margin-left: 200px; } .nonblank { float: left; list-style: none; border: 1px solid #999; height: 31px; line-height: 31px; width: 110px; text-align: center; background-color: #efeff7; font-size: 15px; font-weight: 600; cursor:pointer; } .blank { float: left; border:none; border-bottom:1px solid #999; width:5px; line-height:31px; height: 32px; margin:0; list-style: none; } </style>
3. JS Code
<script type="text/javascript" src="script/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(function () { $("li[class=nonblank]").each(function (index) { $(this).mouseover(function () {// $(this).css("backgroundColor", "red"); }).click(function () { $("li[class=nonblank]").css("backgroundColor", "#efeff7"); $("li[class=nonblank]").css("borderBottom", "1px solid #999"); $(this).css("backgroundColor", "white"); $(this).css("borderBottom", "none"); }).mouseout(function () {// $("li[class=nonblank]").css("backgroundColor", "#efeff7"); }) }) }) </script>
4,