Div+css to create a level two horizontal pop-up menu, slightly simpler

Source: Internet
Author: User

The display of level two menus is not controlled using JavaScript, as shown in the results.

The code is as follows:

1 <! DOCTYPE html>2 3 4 <meta charset= "UTF-8" >5 <title> Pure Div+css production level two horizontal pop-up menu </title>6 <style type= "Text/css" >7 . Menu{8 font-family:Arial,sans-serif;9         /*width:750px; The width setting here is not required .*/Ten padding:0; One margin:50px; A} - . Menu ul{ - padding:0; the margin:0; -         /*ul and OL, Li have list-style-type properties,*/ - List-style-type:None; -} + . Menu ul Li{ -     /*The Float property defines the direction in which the element floats, and a floating element generates a block-level box. If the floating non-replacement element is + indicate a definite width, otherwise it will be compressed as much as possible. */ A float: Left; at position:relative; - List-style-type:None; -} - . Menu ul li A,. Menu ul Li a:visited{ -         /*the value of display, none means not to be displayed, and block represents a block-level element, before and after the element - there is a newline character, inline is the default value, inline element, and there is no line break ...*/ in Display:Block; - text-align:Center; to text-decoration:None; + width:104px; - Height:30px; the Color:#000; * Border-width:1px solid #fff; $ background:#c9c9a7;Panax Notoginseng Line-height:30px; - font-size:11px; the} +     /*do not display when mouse is not in action*/ A . Menu UL Li ul{ the Display:None; +} -     /*when the mouse points to the first level of Li, the second-level UL action*/ $ . Menu UL Li:hover ul{ $ Display:Block; - position:Absolute; - Top:30px; the  Left:0; - width:105px;Wuyi} the . Menu UL Li:hover ul li a{ - Display:Block; Wu background:#faeec7; - Color:#000; About} $ . Menu UL li:hover ul li A:hover{ - background:#dfc184; - Color:#000; -} A     /*The clear property defines the side on which the element is not allowed to appear floating elements. */ + . Clear{ the Clear:both; -} $ </style> the  the  the <body> the <div class= "menu" > - <ul> in <li><a class= "Hide" href= "#" > Level menu </a> the <ul> the <li><a href= "#" > Level two menu </a></li> About <li><a href= "#" > Level two menu </a></li> the <li><a href= "#" > Level two menu </a></li> the </ul> the </li> + <li><a class= "Hide" href= "#" > Level menu </a> - <ul> the <li><a href= "#" > Level two menu </a></li>Bayi <li><a href= "#" > Level two menu </a></li> the <li><a href= "#" > Level two menu </a></li> the </ul> - </li> - <li><a class= "Hide" href= "#" > Level menu </a> the <ul> the <li><a href= "#" > Level two menu </a></li> the <li><a href= "#" > Level two menu </a></li> the <li><a href= "#" > Level two menu </a></li> - </ul> the </li> the <li><a class= "Hide" href= "#" > Level menu </a></li> the <div class= "clear" ></div>94 </ul> the      the </div> the 98 </body> About 

Div+css to create a level two horizontal pop-up menu, slightly simpler

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.