基于JS实现网页中的选项卡(两种方法)
网页中经常会用到选项卡这种东东,说白了就是点击一个选项,下面会弹出这个选项里的内容。
方法一:
方法一利用简单的代码即可实现,以下是全部的代码;
选项卡 *{margin:0;padding:0;} #box{width:600px;background:#ccc;margin:0auto;} li{list-style:none;} #ul1{display:block;width:100%;overflow:hidden;} #ul1li{width:110px;height:40px;background:#4cfed2;float:left;margin-left:8px;text-align:center;line-height:40px;} #content{width:100%;margin-top:20px;} #contentdiv{display:none;} #contentdiv.active{display:block;} .show{background:red;} 首页 产品 新闻 联系 我的
- new1
- new2
- new3
- new4
- new5
- new6
- new7
- new8
- new9
- new10
- new11
- new12
- new13
- new14
- new15