Fully compatible pure CSS cascade menu

Source: Internet
Author: User
    • Participating browsers: IE6/IE7/IE8/ff3/op9.6/sf3/chrome2
    • Operating System: Windows
    • The first release of the blue ideal classic Forum. For more information, see the source.

This time, the cascading menu for the project uses the pure CSS method. Hook, you can do it with CSS.

Some predecessors have already completed such an instance. I thought I could do it smoothly, but I did not expect to hit the wall everywhere. So I will record some of my experiences as follows for your reference.

Don't talk nonsense. Let's get started!

In addition to IE6, this strong child, other browsers are easy to conquer.

 

There are two key points to completing the instance:

    1. Do not be frivolous. Step by step, first display: none at the lowest level.
    2. ": Hover pseudo class" is used. The default status is "display: none;". If ": hover" is used, "display: block;" is easy to complete.

However, IE6 is complicated. After the lessons learned, the key four points are summarized.:

1. principle: IE6 only supports <A> label: hover pseudo class. However, if tag a is embedded in tag a, tag a does not take effect, therefore, you must add a <Table> layer between them;

<! -[If IE 6]> <a href = "# Nogo"> <Table> <tr> <TD> <! [Endif]->
The content part can contain <A> tags
<! -[If IE 6]> </TD> </tr> </table> </a> <! [Endif]->

2. key style name: This is used to name the label of the hover effect. If the name of the style is the same as that of <li> (Li: hover produces the effect in non-IE6 ), there will be no additional style WritingCodeNot only saves code overhead, but also makes it more maintainable (this is the key to saving time and effort)

<Li class = "Li">
<! -[If IE 6]> <a class = "Li" href = "# Nogo"> <Table> <tr> <TD>
<! [Endif]->
The content part can contain <A> tags
<! -[If IE 6]> </TD> </tr> </table> </a> <! [Endif]->
</LI>

3. Use of visibility: If you use display, the optiongroup shown last time in onmouseout still does not disappear.

. C_subnav. Li: hover ul {visibility: visible ;}

4. Table settings: [Tearful ing] the table must remember width: 100%; Ah, remember.

 

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">

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.