I have begun writing a CSS and HTML collapsing menu system (AKA an accordion). I followed the tutorial posted here, however, I had to change it slightly. Instead of using <a> and <p> tags, I had to use <div> tags because I will be adding images to both ‘sections’ at a later stage. After I change the <a> and <p> tags to <div> tags, the slide-out content does not display when the mouse is hovering over the box. It is only when the mouse is moved away does the content briefly display before the ‘drawer’ retracts. I have posted my code bellow and any help would be very much appreciated.
Link to my CSS: http://cl.ly/Cuoe
Link to my HTML: http://cl.ly/Cuhf
Many Thanks.
I think the problem is that your
#accordion div:hoverCSS rule is now catching both theitemdiv AND theitemTitleanditemContentdivs inside the item.In your CSS file, try replacing both instances of
#accordion div:hoverwith#accordion div.item:hover. This will cause the rule to only apply to divs with classitem.Edit: You could also just change it to
#accordion .item:hover