Div css drop-down menu effect code

Source: Internet
Author: User
The code is as follows: Copy code

<! Doctype html public "-// w3c // dtd xhtml 1.0 strict // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
<Html xmlns = "http://www.111cn.net/1999/xhtml">
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312"/>
<Title> webpage special effects drop-down menu </title>
<Style type = "text/css">
*{
Padding: 0;
Margin: 0;
}
Body {
Font-family: verdana, sans-serif;
Font-size: small;
}
# Navigation, # navigation li ul {
List-style-type: none;
}
# Navigation {
Margin: 20px;
}
# Navigation li {
Float: left;
Text-align: center;
Position: relative;
}
# Navigation li a: link, # navigation li a: visited {
Display: block;
Text-decoration: none;
Color: #000;
Width: 120px;
Height: 40px;
Line-height: 40px;
Border: 1px solid # fff;
Border-width: 1px 1px 0 0;
Background: # c5dbf2;
Padding-left: 10px;
}
# Navigation li a: hover {
Color: # fff;
Background: # 2687eb;
}
# Navigation li ul li a: hover {
Color: # fff;
Background: # 6b839c;
}
# Navigation li ul {
Display: none;
Position: absolute;
Top: 40px;
Left: 0;
Margin-top: 1px;
Width: 120px;
}
# Navigation li ul {
Display: none;
Position: absolute;
Top: 0px;
Left: 130px;
Margin-top: 0;
Margin-left: 1px;
Width: 120px;
}
</Style>
<Script type = "text/javascript">
Function displaysubmenu (li ){
Var submenu = li. getelementsbytagname ("ul") [0];
Submenu. style. display = "block ";
}
Function hidesubmenu (li ){
Var submenu = li. getelementsbytagname ("ul") [0];
Submenu. style. display = "none ";
}
</Script>
</Head>
<Body>
<Ul id = "navigation">
<Li onmouseo tutorial ver = "displaysubmenu (this)" onmouseout = "hidesubmenu (this)">
<A href = "#"> Topic 1 </a>
<Ul>
<Li> <a href = "#"> Topic 1-> Menu 1 </a> </li>
<Li> <a href = "#"> Topic 1-> Menu 2 </a> </li>
<Li> <a href = "#"> Topic 1-> menu 3 </a> </li>
<Li> <a href = "#"> Topic 1-> menu 4 </a> </li>
</Ul>
</Li>
<Li onmouseover = "displaysubmenu (this)" onmouseout = "hidesubmenu (this)">
<A href = "#"> Topic 2 </a>
<Ul>
<Li> <a href = "#"> Topic 2-> Menu 1 </a> </li>
<Li> <a href = "#"> Topic 2-> Menu 2 </a> </li>
<Li> <a href = "#"> Topic 2-> menu 3 </a> </li>
<Li> <a href = "#"> Topic 2-> menu 4 </a> </li>
<Li> <a href = "#"> Topic 2-> Menu 5 </a> </li>
</Ul>
</Li>
<Li onmouseover = "displaysubmenu (this)" onmouseout = "hidesubmenu (this)">
<A href = "#"> Topic 3 </a>
<Ul>
<Li onmouseover = "displaysubmenu (this)" onmouseout = "hidesubmenu (this)">
<A href = "#"> Topic 3-> Menu 1 </a>
<Ul>
<Li> <a href = "#"> Menu 1-> sub-menu 1 </a> </li>
<Li> <a href = "#"> Menu 1-> sub-menu 2 </a> </li>
<Li> <a href = "#"> Menu 1-> sub-menu 3 </a> </li>
<Li> <a href = "#"> Menu 1-> sub-menu 4 </a> </li>
</Ul>
</Li>
<Li> <a href = "#"> Topic 3-> Menu 2 </a> </li>
<Li onmouseover = "displaysubmenu (this)" onmouseout = "hidesubmenu (this)">
<A href = "#"> Topic 3-> menu 3 </a>
<Ul>
<Li> <a href = "#"> menu 3-> sub-menu 1 </a> </li>
<Li> <a href = "#"> menu 3-> sub-menu 2 </a> </li>
<Li> <a href = "#"> menu 3-> sub-menu 3 </a> </li>
</Ul>
</Li>
</Ul>
</Li>
</Ul>
</Body>
</Html>

Navigation Menu 2

The code is as follows: Copy code

<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en ""Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns =Http://www.111cn.net/1999/xhtml>
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = utf-8"/>
<Title> imitation menu </title>
<Style type = "text/css">
Body {font-size: 14px ;}
Ul {margin: 0; padding: 0; list-style: none ;}
A {text-decoration: none; color: #000 ;}

# Menu {position: absolute; top: 0; left: 100px; width: 780px ;}
# Menu li {float: left; height: 34px; line-height: 34px ;}
# Menu li a {display: block; font-weight: bold; background: url(link.gif) left top; padding-left: 20px ;}
# Menu span {display: block; background: url(link.gif) no-repeat right top; padding-right: 20px ;}
# Menu li a: hover {background: url(hover.gif) no-repeat left top; color: # c30 ;}
# Menu li a: hover span {background: url(hover.gif) no-repeat right top ;}

# Sub_menu {position: absolute; top: 35px; font-size: 12px; line-height: 2em ;}
# Sub_menu # sub_2 {margin-left: 150px ;}
# Sub_menu # sub_3 {margin-left: 250px ;}
# Sub_menu # sub_4 {margin-left: 350px ;}
 
. Dis {display: block ;}
. Undis {display: none ;}
</Style>
<Script type = "text/javascript" language = "javascript">
<! --
Function show (n ){
// If there are n tags, I <= n;
For (var I = 1; I <= 6; I ++ ){
Document. getelementbyid ('sub _ '+ I). classname = 'undis ';
}
Document. getelementbyid ('sub _ '+ n). classname = 'dis ';
}  
-->
</Script>
</Head>

<! -- There is no time to add analysis points when you rush out. If you don't understand anything, ask me. You can modify other small details on your own! -->
<Body>
<Div id = "nav">
<Div id = "menu">
<Ul>
<Li> <a href = "#" onmouseover = "show (1)"> <span> Caesar homepage </span> </a> </li>
<Li> <a href = "#" onmouseover = "show (2)"> <span> Latest dynamic page </span> </a> </li>
<Li> <a href = "#" onmouseover = "show (3)"> <span> Product and reservation center page </span> </a> </li>
<Li> <a href = "#" onmouseover = "show (4)"> <span> Help and query Center page </span> </a> </li>
<Li> <a href = "#" onmouseover = "show (5)"> <span> member club page </span> </a> </li>
<Li> <a href = "#" onmouseover = "show (6)"> <span> Caesar forum page </span> </a> </li>
</Ul>
</Div>
<Div id = "sub_menu">
<Div id = "sub_1" class = "undis"> </div>
<Div id = "sub_2" class = "undis"> <a href = http://mb.111cn.net> focus on Caesar </a> | <a href = "#"> Domestic News </a> | <a href = "#"> International News </a> </div>
<Div id = "sub_3" class = "undis"> <a href = "#"> focus on Caesar </a> | <a href = "#"> Chinese News </ a> | <a href = "#"> International News </a> focus on Caesar </a> | <a href = "#"> Domestic News </a> </ div>
<Div id = "sub_4" class = "undis"> <a href = "#"> booking process </a> | <a href = "#"> order query </ a> | <a href = "#"> online Q & a </a> <a href = "#"> Visa Service </a> | <a href = "http://down.111cn.net"> travel guide </a> | <a href = "#"> website map </a> </div>
<Div id = "sub_5" class = "undis"> </div>
<Div id = "sub_6" class = "undis"> </div>
</Div>
</Div>
</Body>
</Html>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.