views:

24

answers:

1

Hi!

I had a mouseover submenu working very nicely on my site (so nicely in fact that it was working exactly right in Chrome, IE 7 & 8, and FF), but now it's broken somehow and I can't see the problem.

Here's the CSS:

.MainMenu {
    width: 90% !important;
    min-width: 800px;
    height: 42px !important;
    padding: 0 0 0 10%;
    overflow: hidden;
    border-top: 1px solid #0054a6;
    border-bottom: 1px solid #0054a6;
    background: transparent url("Images/ServiceMenuBG.png");
    background-repeat: repeat-x;
}
.MainMenu ul {
    padding: 0;
    margin:0;
    list-style: none;
}
.MainMenu li {
    float: left;
    position: relative;
    height: 31px;
    width: 150px;
    padding: 11px 0 0 0;
    text-align: center;
    border-right: 1px solid #0054a6;
}
.MainMenuItem#First { border-left: 1px solid #0054a6; }
.MainMenuItem a {
    color: #ffffff;
    display: block;
    height: 31px;
    width: 150px;
    font-weight: bold;
    text-decoration: none;
}
.MainMenuItem:hover { background: transparent url("Images/ServiceMenuBG.png") repeat-x 0 -42px; }
.SubMenu {
    z-index: 500;
    display: none;
    width: 150px !important;
    position: absolute;
    top: 10px;
    left: 0;
    background-color: rgb(51,118,184);
}
.SubMenu li { padding: 0 0 2px 5px; height: 20px !important; width: 143px; }
.SubMenu li a {
    height: 20px !important;
    font-weight: normal;
    color: #ffffff;
    text-align: left;
    text-decoration: none;
}
.SubMenu li a:hover { text-decoration: underline; }
.MainMenu li.MainMenuItem>ul { top: auto; left: auto; }
.MainMenu li.MainMenuItem:hover ul { display: block; }'

Here's the HTML:

<div class="MainMenu">
    <ul>
        <li class="MainMenuItem" id="First"><a href="~/Default.aspx">Home</a></li>
        <li class="MainMenuItem"><a href="Pages/Philosophies.aspx">Philosophies</a></li>
        <li class="MainMenuItem"><a href="Pages/Services.aspx#top">Services</a>
            <ul class="SubMenu">
                <li id="TopItem"><a href="Pages/Services.aspx#shop">Shop Repair</a></li>
                <li><a href="Pages/Services.aspx#donations">Donations</a></li>
                <li><a href="Pages/Services.aspx#consulting">Consulting</a></li>
                <li id="BottomItem"><a href="Pages/Services.aspx#on-site">On-site Service</a></li>
            </ul>
        </li>
        <li class="MainMenuItem"><a href="Pages/Contracts.aspx">Contracts</a></li>
        <li class="MainMenuItem"><a href="Pages/AboutUs.aspx">About Us</a></li>
        <li class="MainMenuItem"><a href="Pages/ContactUs.aspx">Contact Us</a></li>
    </ul>
</div>

The SubMenu doesn't display either on mouseover or if I set it's initial display property to block. It's as if it doesn't exist on the page at all.

Thanks in advance for any help.

+1  A: 
.MainMenu { overflow: hidden; }

is hiding the sub menus, so remove that line. Line 6 in your CSS.

As Sotiris mentioned

.MainMenuItem a { color: #ffffff; }

hides the top menu items (maybe not on your version because I see you have a background image)

MattMS
Thank you :) Wonder why I put that `overflow: hidden;` in there to begin with...
Logan Young
That's ok :)The only reason I could see would be in case the text goes outside the menu title area. If that's the case you could apply the overflow:hidden; to the actual link instead, as in.MainMenu a { overflow: hidden; }This will apply to all the child menu items too.Hope that helps.
MattMS