Currently, the most popular TAB tabs for large portal websites such as Sina. The code for the entire webpage is as follows. There may be some redundant code with limited capabilities. You can add background images by changing the background color, make exquisite button tabs with gradient and metallic texture.
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> untitled document </title>
<Style type = "text/css">
<! --
. Zhuti {
Width: 173px;
Height: 300px ;}
Li {
Width: 41px;
List-style-type: none;
Height: 22px;
Float: left;
Margin-right: 1px;
Background-repeat: repeat-x;
Border: 1px solid # CCCCCC;
Background-color: # CCCCCC;
}
. Zhongjian {
Width: 173px;
Height: 270px;
Background-color: # FFCC00;
Text-align: center;
Border-top-width: 1px;
Border-right-width: 1px;
Border-bottom-width: 1px;
Border-left-width: 1px;
Border-top-style: none;
Border-right-style: solid;
Border-bottom-style: solid;
Border-left-style: solid;
Border-top-color: # FF9900;
Border-right-color: # FF9900;
Border-bottom-color: # FF9900;
Border-left-color: # FF9900;
}
. Nei {
Width: 173px;
Height: 270px;
Display: none;
}
Ul {
Width: 205px;
Height: 22px;
Text-align: center;
Margin: 0px;
}
. Over {
Border-top-width: 1px;
Border-right-width: 1px;
Border-bottom-width: 1px;
Border-left-width: 1px;
Border-top-style: solid;
Border-right-style: solid;
Border-bottom-style: solid;
Border-left-style: solid;
Border-top-color: # FF9900;
Border-right-color: # FF9900;
Border-bottom-color: # FFCC00;
Border-left-color: # FF9900;
Background-color: # FFCC00;
}
. Out {
Border: 1px solid # CCCCCC;
Background-color: # CCCCCC;
}
-->
</Style>
<Script>
Function set (n)
{
For (I = 0; I <4; I ++)
{
Ul1.document. getElementById ('l' + I). className = "out ";
Div1.document. getElementById ('D' + I). style. display = "none ";
}
Ul1.document. getElementById ('l' + n). className = "over ";
Div1.document. getElementById ('D' + n). style. display = "block ";
}
Function body_load ()
{
Ul1.document. getElementById ('l' + 0). className = "over ";
Ul1.document. getElementById ('D' + 0). style. display = "block ";
}
</Script>
</Head>
<Body onload = "body_load ()">
<Div class = "zhti">
<Ul id = "ul1">
<Li id = "l0" onmouseover = "set (0)">
</Li>
<Li id = "l1" onmouseover = "set (1)">
</Li>
<Li id = "l2" onmouseover = "set (2)">
</Li>
<Li id = "l3" onmouseover = "set (3)">
</Li>
</Ul>
<Div class = "zhongjian" id = "div1">
<Div class = "nei" id = "d0">
Tab 1 content:
HUAIHUAI
</Div>
<Div class = "nei" id = "d1">
Tab 2 content:
Bad
</Div>
<Div class = "nei" id = "d2">
Tab 3 content:
Bad dog
</Div>
<Div class = "nei" id = "d3">
Tab 4 content:
Good
</Div>
</Div>
</Div>
</Body>
</Html>