[html]选项卡效果

<!doctype html>
<html>
 <head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
  <style type="text/css">
    .menu{background:#eee; border-bottom:1px solid #0f52a4;}
    a{
      display:inline-block;
      width:100px;
      height:36px;
      line-height:36px;
      text-align:center;
      color: #0f52a4;
      font-weight: bold;
      text-decoration: none;
      position:relative;
      top:1px;
    }
    .current a{
      background:#fff;
      border-top:2px solid #0f52a4;
    }
    div div{
      display:none;
      border-bottom:1px solid #0f52a4;
    }
  </style>
  <script type="text/javascript">
    $(function(){
        $('div div:first').show();
        $('span').mouseenter(function(){
            $('span').removeClass('current');
            $(this).addClass('current');
            $('div div').hide();
            $('div div').eq($('span').index(this)).show();
        });
    });
  </script>
 </head>
 <body>
 <div class="menu">
  <span class="current"><a href="#">晨间新闻</a></span>
  <span><a href="#">午间新闻</a></span>
  <span><a href="#">晚间新闻</a></span>
  <span><a href="#">视频新闻</a></span>
 </div>
 <div>
  <div>晨间新闻</div>
  <div>午间新闻</div>
  <div>晚间新闻</div>
  <div>视频新闻</div>
 </div>
 </body>
</html>

 本文内容参考:http://h-ui.net/Hui-4.5-tab.shtml

posted on 2016-06-22 22:07  z5337  阅读(362)  评论(0编辑  收藏  举报