CSS adjacent sibling selectors - IE8 problem

前端 未结 2 520
Happy的楠姐
Happy的楠姐 2020-12-11 18:50

I am creating a menu system using a UL/LI structure. I\'m trying to use sibling selectors for hover/show-sub-menus.

I\'m using this;

#MainMenu li.Sel         


        
相关标签:
2条回答
  • would it be simpler to add the hover on the li element and fix the hover for ie using this http://www.xs4all.nl/~peterned/csshover.html

    ie

    #MainMenu li.Sel ul li.HasSub:hover {
         display: block;
    }
    

    Hope that helps

    Josh

    0 讨论(0)
  • 2020-12-11 19:46

    You need to make sure IE is running in standards mode - put in a doctype like this:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
        "http://www.w3.org/TR/html4/loose.dtd"> 
    

    From the documentation:

    The adjacent sibling combinator is a "plus sign" (+) character that separates two simple selectors. Whitespace is not significant.

    A selector of the form "E+F" matches element F when it immediately follows sibling element E in the document tree, ignoring non-element nodes (such as text nodes and comments). Element E and F must share the same parent and E must immediately precede F. To match the first child of the parent, use the :first-child pseudo-class.

    Note Requires Windows Internet Explorer 7 or later.
    Note Combinators are enabled only in standards-compliant mode (strict !DOCTYPE).

    0 讨论(0)
提交回复
热议问题