HTML+CSS implementation drop-down menu

Source: Internet
Author: User

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <Linkrel= "stylesheet"href= "Blog%20css.css"type= "Text/css"/>    <title>Second Level menu</title></Head><Body>        <DivID= "NAV">            <ul>                <Li><ahref="#">Home</a>                </Li>                <Li><ahref="#">New Essays</a>                    <ul>                        <Li><ahref="#">Secondary Menu Level Two menu</a></Li>                        <Li><ahref="#">Second Level menu</a></Li>                        <Li><ahref="#">Second Level menu</a></Li>                    </ul>                </Li>                <Li><ahref="#">Message</a>                    <ul>                        <Li><ahref="#">Secondary Menu Level Two menu</a></Li>                        <Li><ahref="#">Second Level menu</a></Li>                        <Li><ahref="#">Second Level menu</a></Li>                    </ul>                </Li></ul></Div></Div></Body></HTML>
*{margin:0;padding:0;
}/*You can remove the default browser style*/#nav {Background-color:#eeeeee;width:600px;margin:0 Auto;/*Horizontal center of navigation bar*/Height:40px;}ul{List-style:None;}ul Li{float: Left;text-align:Center;/*Vertical center of navigation bar text*/Line-height:40px;position:relative;/*relative positioning allows the level two menu to be displayed under the corresponding one-level menu*/}a{text-decoration:None;Color:Black;Display:Block;/*With padding, let a block fill the entire Li*/padding:0 10px;}a:hover{Background-color:Black;Color:#fff;}ul Li ul Li{float:None;/*cancels the float of a level two menu so that it resumes vertical display*/Background-color:#eeeeee;Margin-top:1px;White-space:nowrap;/*Force A level two menu to be longer than the parent without wrapping, if it is in English or the number is not required*/}UL Li ul{position:Absolute;/*Position the browser as a (0,0) location and do not open a menu because the level two menu is too long*/ Left:0;Top:40px;Display:None;/*allows the initial two-level menu to be hidden*/}UL Li:hover ul{Display:Block;/*allows the mouse to go through the first menu when the level two menu is displayed*/}

HTML+CSS implementation drop-down menu

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.