非常不錯的css滑動門效果網頁選項卡程式碼
阿新 • • 發佈:2019-02-04
好好好強大,可以試試。先看效果圖——
<html>
<head>
<title>簡潔Tab</title>
<style type="text/css">
<!--
body,div,ul,li{
padding:0;
text-align:center;
}
body{
font:12px "宋體";
text-align:center;
}
a:link{
color:#00F;
text-decoration:none;
}
a:visited {
color: #00F;
text-decoration:none;
}
a:hover {
color: #c00 ;
text-decoration:underline;
}
ul{ list-style:none;}
/*選項卡1*/
#Tab1{
width:460px;
margin:0px;
padding:0px;
margin:0 auto;}
/*選項卡2*/
#Tab2{
width:576px;
margin:0px;
padding:0px;
margin:0 auto;}
/*選單class*/
.Menubox {
width:100%;
background:url(http://www.hxcgw.com/bbs/upfile/20079299441652.gif);
height:28px;
line-height :28px;
}
.Menubox ul{
margin:0px;
padding:0px;
}
.Menubox li{
float:left;
display:block;
cursor:pointer;
width:114px;
text-align:center;
color:#949694;
font-weight:bold;
}
.Menubox li.hover{
padding:0px;
background:#fff;
width:116px;
border-left:1px solid #A8C29F;
border-top:1px solid #A8C29F;
border-right:1px solid #A8C29F ;
background:url(http://www.hxcgw.com/bbs/upfile/200792994426548.gif);
color:#739242;
font-weight:bold;
height:27px;
line-height:27px;
}
.Contentbox{
clear:both;
margin-top:0px;
border:1px solid #A8C29F;
border-top:none;
height:181px;
text-align:center;
padding-top:8px;
}
-->
</style>
<script>
<!--
/*第一種形式 第二種形式 更換顯示樣式*/
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
}
//-->
</script>
</head>
<body>
<br><br>
<div id="Tab1">
<div class="Menubox">
<ul>
<li id="one1" onmouseover="setTab('one',1,4)" class="hover">新聞1</li>
<li id="one2" onmouseover="setTab('one',2,4)">新聞2</li>
<li id="one3" onmouseover="setTab('one',3,4)">新聞3</li>
<li id="one4" onmouseover="setTab('one',4,4)">新聞4</li>
</ul>
</div>
<div class="Contentbox">
<div id="con_one_1" class="hover">新聞列表1</div>
<div id="con_one_2" style="display:none">新聞列表2</div>
<div id="con_one_3" style="display:none">新聞列表3</div>
<div id="con_one_4" style="display:none">新聞列表4</div>
</div>
</div>
<br>
<div id="Tab2">
<div class="Menubox">
<ul>
<li id="two1" onmouseover="setTab('two',1,4)" class="hover">新聞1</li>
<li id="two2" onmouseover="setTab('two',2,4)">新聞2</li>
<li id="two3" onmouseover="setTab('two',3,4)">新聞3</li>
<li id="two4" onmouseover="setTab('two',4,4)">
<html>
<head>
<title>簡潔Tab</title>
<style type="text/css">
<!--
body,div,ul,li{
padding:0;
text-align:center;
}
body{
font:12px "宋體";
text-align:center;
}
a:link{
color:#00F;
text-decoration:none;
}
a:visited {
color: #00F;
text-decoration:none;
}
a:hover {
color: #c00
text-decoration:underline;
}
ul{ list-style:none;}
/*選項卡1*/
#Tab1{
width:460px;
margin:0px;
padding:0px;
margin:0 auto;}
/*選項卡2*/
#Tab2{
width:576px;
margin:0px;
padding:0px;
margin:0 auto;}
/*選單class*/
.Menubox {
width:100%;
background:url(http://www.hxcgw.com/bbs/upfile/20079299441652.gif);
height:28px;
line-height
}
.Menubox ul{
margin:0px;
padding:0px;
}
.Menubox li{
float:left;
display:block;
cursor:pointer;
width:114px;
text-align:center;
color:#949694;
font-weight:bold;
}
.Menubox li.hover{
padding:0px;
background:#fff;
width:116px;
border-left:1px solid #A8C29F;
border-top:1px solid #A8C29F;
border-right:1px solid #A8C29F
background:url(http://www.hxcgw.com/bbs/upfile/200792994426548.gif);
color:#739242;
font-weight:bold;
height:27px;
line-height:27px;
}
.Contentbox{
clear:both;
margin-top:0px;
border:1px solid #A8C29F;
border-top:none;
height:181px;
text-align:center;
padding-top:8px;
}
-->
</style>
<script>
<!--
/*第一種形式 第二種形式 更換顯示樣式*/
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
}
//-->
</script>
</head>
<body>
<br><br>
<div id="Tab1">
<div class="Menubox">
<ul>
<li id="one1" onmouseover="setTab('one',1,4)" class="hover">新聞1</li>
<li id="one2" onmouseover="setTab('one',2,4)">新聞2</li>
<li id="one3" onmouseover="setTab('one',3,4)">新聞3</li>
<li id="one4" onmouseover="setTab('one',4,4)">新聞4</li>
</ul>
</div>
<div class="Contentbox">
<div id="con_one_1" class="hover">新聞列表1</div>
<div id="con_one_2" style="display:none">新聞列表2</div>
<div id="con_one_3" style="display:none">新聞列表3</div>
<div id="con_one_4" style="display:none">新聞列表4</div>
</div>
</div>
<br>
<div id="Tab2">
<div class="Menubox">
<ul>
<li id="two1" onmouseover="setTab('two',1,4)" class="hover">新聞1</li>
<li id="two2" onmouseover="setTab('two',2,4)">新聞2</li>
<li id="two3" onmouseover="setTab('two',3,4)">新聞3</li>
<li id="two4" onmouseover="setTab('two',4,4)">