Css second-level menu implementation code set correction

Source: Internet
Author: User

<! DOCTYPE html PUBliC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml" lang = "zh-CN"> <pead> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "/> <title> css menu demonstration </title> <style type =" text/css "> </style> </pead> <body> <ul id = "nav"> <li> <ul> <li> script column </li> <li> network programming </li> <li> database </li> <li> source code download </li> <li> Software Download </li> </ul> </li> <li> service Introduction <ul> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 Service 2 </li> /li> <li> Service 2 </li> </ul> </li> <li> success stories <ul> <li> case 3 </li> <li> case 3 case 3 </li> <li> case 3 </li> <li> case 3 case 3 </li> </ul> </li> <li> about Us <ul> <li> ours 4 </li> <li> ours 4 </li> <li> ours 4 </li> <li> ours 4 111 </li>/ li> </ul> </li> <li> online demonstration <ul> <li> demonstration </li>/ li> <li> demo demonstration </li> <li> demo </li>> <li> demo </li> </ul> </li> <li> Contact Us <ul> <li> Contact Us </li>> <li> contact </li> <li> contact </li> <li> contact </li> </ul> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Method 2:
In fact, the so-called level-2 menus are similar. It is nothing more than defining a layer for level-2 menus. When you place the cursor over the level-1 menu, this layer is displayed, this layer is hidden when you move the mouse from the top menu. Therefore, this classic CSS second-level menu can be used to derive many different second-level menus, one of which is spring-type, as shown in.


<! DOCTYPE html PUBliC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml" lang = "zh-CN"> <pead> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "/> <title> css menu demonstration </title> <style type =" text/css "> </style> </pead> <body> <ul id = "nav"> <li> product introduction <ul> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> </ul> </li> <li> service Introduction <ul> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li>> <li> Service 2 Service 2 </li> <li> Service 2 </li> </ul> </li> <li> success stories <ul> <li> case 3 </li> <li> case 3 </li> <li> case 3 case 3 </li> </ul> </li> <li> about us <ul> <li> ours 4 </li> <li> ours 4 </li> <li> ours 4 </li> <li> our 4th 111 </li> </ul> </li> <li> online demonstration <ul> <li> demonstration </li> <li> demo </li> <li> demo </li>/ li> <li> demonstration </li> </ul> </li> <li> Contact Us <ul> <li> contact </li> <li> contact </li> </ul> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
You can also change the level-2 menu to a horizontal one, as shown in the following two figures.

<! DOCTYPE html PUBliC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml" lang = "zh-CN"> <pead> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "/> <title> css menu demonstration </title> <style type =" text/css "> </style> </pead> <body> <ul id = "nav"> <li> product introduction <ul> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> </ul> </li> <li> service Introduction <ul> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> </ul> </li> <li> success stories <ul> <li> case 3 </li> <li> case 3 </li> <li> case 3 </li> </ul> </li> <li> about us <ul> <li> ours 4 </li> <li> ours 4 </li> <li> ours 4 </li> <li> ours 4 111 </li> </ul> </li> <li> online demonstration <ul> <li> demonstration </li> <li> demonstration </li> <li> demonstration </li>> <li> demo </li> </ul> </li> <li> Contact Us <ul> <li> Contact Us </li> <li> contact us </li> <li> contact </li> <li> contact </li> </ul> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
<! DOCTYPE html PUBliC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml" lang = "zh-CN"> <pead> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "/> <title> css menu demonstration </title> <style type =" text/css "> </style> </pead> <body> <ul id = "nav"> <li> product introduction <ul> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> </ul> </li> <li> service Introduction <ul> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> </ul> </li> <li> success stories <ul> <li> case 3 </li> <li> case 3 </li> <li> case 3 </li> </ul> </li> <li> about us <ul> <li> ours 4 </li> <li> ours 4 </li> <li> ours 4 </li> <li> ours 4 111 </li> </ul> </li> <li> online demonstration <ul> <li> demonstration </li> <li> demonstration </li> <li> demonstration </li>> <li> demo </li> </ul> </li> <li> Contact Us <ul> <li> Contact Us </li> <li> contact us </li> <li> contact </li> <li> contact </li> </ul> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
The preceding menus run in IE, Firefox, Opera, and Flock browsers. However, if you click the mouse in the level-1 menu, the level-2 menu will not disappear. This is a bug. In addition, there is a horizontal level-2 menu, as shown in. This menu is successfully run in IE, but it does not work properly in Firefox, Opera, and Flock browsers.


<! DOCTYPE html PUBliC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml" lang = "zh-CN"> <pead> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "/> <title> css menu demonstration </title> <style type =" text/css "> </style> </pead> <body> <ul id = "nav"> <li> product introduction <ul> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> <li> product 1 </li> </ul> </li> <li> service Introduction <ul> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li> <li> Service 2 </li>> <li> Service 2 Service 2 </li> <li> Service 2 </li> </ul> </li> <li> success stories <ul> <li> case 3 </li> <li> case 3 </li> <li> case 3 case 3 </li> </ul> </li> <li> about us <ul> <li> ours 4 </li> <li> ours 4 </li> <li> ours 4 </li> <li> our 4th 111 </li> </ul> </li> <li> online demonstration <ul> <li> demonstration </li> <li> demo </li> <li> demo </li>/ li> <li> demonstration </li> </ul> </li> <li> Contact Us <ul> <li> contact </li> <li> contact </li> </ul> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Package and download the above script files

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.