Code of the pure css drop-down navigation menu

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

Body {
Font: normal. 8em/1.5em Arial, Helvetica, sans-serif;
Background: # ebeb;
Width: 900px;
Margin: 100px auto;
Color: #666;
}

A {
Color: #333;
}
# Nav {
Margin: 0;
Padding: 7px 6px 0;
Background: # 7d7d7d url (img/gradient.png) repeat-x 0-110px;
Line-height: 100%;

Border-radius: 2em;
-Webkit-border-radius: 2em;
-Moz-border-radius: 2em;

-Webkit-box-shadow: 0 1px 3px rgba (0, 0,. 4 );
-Moz-box-shadow: 0 1px 3px rgba (0, 0,. 4 );
}
# Nav li {
Margin: 0 5px;
Padding: 0 0 8px;
Float: left;
Position: relative;
List-style: none;
}


/* Main level link */
# Nav {
Font-weight: bold;
Color: # e7e5e5;
Text-decoration: none;
Display: block;
Padding: 8px 20px;
Margin: 0;

-Webkit-border-radius: 1.6em;
-Moz-border-radius: 1.6em;
 
Text-shadow: 0 1px 1px rgba (0, 0, 0,. 3 );
}
# Nav a: hover {
Background: #000;
Color: # fff;
}

/* Main level link hover */
# Nav. current a, # nav li: hover> {
Background: #666 url (img/gradient.png) repeat-x 0-40px;
Color: #444;
Border-top: solid 1px # f8f8f8;

-Webkit-box-shadow: 0 1px 1px rgba (0, 0,. 2 );
-Moz-box-shadow: 0 1px 1px rgba (0, 0,. 2 );
Box-shadow: 0 1px 1px rgba (0, 0, 0,. 2 );

Text-shadow: 0 1px 0 rgba (255,255,255, 1 );
}

/* Sub levels link hover */
# Nav ul li: hover a, # nav li: hover li {
Background: none;
Border: none;
Color: #666;

-Webkit-box-shadow: none;
-Moz-box-shadow: none;
}
# Nav ul a: hover {
Background: # 0078ff url (img/gradient.png) repeat-x 0-100px! Important;
Color: # fff! Important;

-Webkit-border-radius: 0;
-Moz-border-radius: 0;

Text-shadow: 0 1px 1px rgba (0, 0, 0,. 1 );
}

/* Dropdown */
# Nav li: hover> ul {
Display: block;
}

/* Level 2 list */
# Nav ul {
Display: none;

Margin: 0;
Padding: 0;
Width: 185px;
Position: absolute;
Top: 35px;
Left: 0;
Background: # ddd url (img/gradient.png) repeat-x 0 0;
Border: solid 1px # b4b4b4;

-Webkit-border-radius: 10px;
-Moz-border-radius: 10px;
Border-radius: 10px;

-Webkit-box-shadow: 0 1px 3px rgba (0, 0,. 3 );
-Moz-box-shadow: 0 1px 3px rgba (0, 0,. 3 );
Box-shadow: 0 1px 3px rgba (0, 0, 0,. 3 );
}
# Nav ul li {
Float: none;
Margin: 0;
Padding: 0;
}

# Nav ul {
Font-weight: normal;
Text-shadow: 0 1px 0 # fff;
}

/* Level 3 + list */
# Nav ul {
Left: 181px;
Top:-3px;
}

/* Rounded corners of first and last link */
# Nav ul li: first-child> {
-Webkit-border-top-left-radius: 9px;
-Moz-border-radius-topleft: 9px;

-Webkit-border-top-right-radius: 9px;
-Moz-border-radius-topright: 9px;
}
# Nav ul li: last-child> {
-Webkit-border-bottom-left-radius: 9px;
-Moz-border-radius-bottomleft: 9px;

-Webkit-border-bottom-right-radius: 9px;
-Moz-border-radius-bottomright: 9px;
}

/* Clearfix */
# Nav: after {
Content :".";
Display: block;
Clear: both;
Visibility: hidden;
Line-height: 0;
Height: 0;
}
# Nav {
Display: inline-block;
}
Html [xmlns] # nav {
Display: block;
}
 
* Html # nav {
Height: 1%;
}

Html

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.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> CSS3 Dropdown Menu </title>
<Link href = "style.css" rel = "stylesheet" type = "text/css"/>
</Head>

<Body>
<Ul id = "nav">
<Li class = "current"> <a href = "http: // w"> Home </a> </li>
<Li> <a href = "#"> My Projects </a>

<Ul>
<Li> <a href = ""> N. Design Studio </a>
<Ul>
<Li> <a href = "#/portfolio"> Portfolio </a> </li>
<Li> <a href = "#/wp-themes"> WordPress Themes </a> </li>
<Li> <a href = "#/wallpapers"> Wallpapers </a> </li>
<Li> <a href = "#/tutorials"> Illustrator Tutorials </a> </li>

</Ul>
</Li>
<Li> <a href = "http://www.webdesignerwall.com"> Web Designer Wall </a>
<Ul>
<Li> <a href = "http://jobs.webdesignerwall.com"> Design Job Wall </a> </li>
</Ul>
</Li>
<Li> <a href = "http://icondock.com"> IconDock </a> </li>

<Li> <a href = "h #"> Best Web Gallery </a> </li>
</Ul>
</Li>
<Li> <a href = "#"> Multi-Levels </a>
<Ul>
<Li> <a href = "#"> Team </a>
<Ul>

<Li> <a href = "#"> Sub-Level Item </a> </li>
<Li> <a href = "#"> Sub-Level Item </a>
<Ul>
<Li> <a href = "#"> Sub-Level Item </a> </li>
<Li> <a href = "#"> Sub-Level Item </a> </li>
<Li> <a href = "#"> Sub-Level Item </a> </li>

</Ul>
</Li>
     
<Li> <a href = "#"> Sub-Level Item </a> </li>
</Ul>
</Li>
<Li> <a href = "#"> Sales </a> </li>
<Li> <a href = "#"> Another Link </a> </li>

<Li> <a href = "#"> Department </a>
<Ul>
<Li> <a href = "#"> Sub-Level Item </a> </li>
<Li> <a href = "#"> Sub-Level Item </a> </li>
<Li> <a href = "#"> Sub-Level Item </a> </li>
</Ul>
</Li>

</Ul>
</Li>
<Li> <a href = "#"> About </a> </li>
<Li> <a href = "#"> Contact Us </a> </li>
</Ul>

</Body>

</Html>

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.