Frage

I am using jmenu.js and setting child menu elements to have transparency. Problem is that the child elements with transparency show the parent's (i.e. main menu bar) background. What I want is have transparency on the child menus which show through to the page background. The CSS is:

.jMenu {
    display: table;
    margin: 0 0 0 50px;
    padding: 0;
}

/* First level */
.jMenu li {
    display: table-cell;
    background: url('../images/tile_gray.png');
    margin: 0;
}

.jMenu li a {
    padding: 10px;
    padding-right:55px;
    display: block;
    background-color: transparent;
    color: white;
    text-transform: uppercase;
    margin-top:2px;
    cursor: pointer;
    font-size: 14px;
    font-family: Myriad Pro, Lucida Sans, Segoe UI, Calibri, sans serif;
    font-weight: bold;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}


/* Lower levels */
.jMenu li ul {
    display: none;
    position: absolute;
    z-index:9999;
    padding: 0;
    margin: 0;
}

.jMenu li ul li {
    background-color: #fff;
    display: block;

    padding: 0;
}

.jMenu li ul li.arrow {
    background: url('../images/tile_pink.png');
    padding: 0;
    border-bottom: none;
    padding-bottom: 5px;
    margin-top: 10px;
}

.jMenu li ul li a {

    font-size: 13px;
    text-shadow: 0px 0px 0px rgba(0,0,0,0);
    text-transform: none;
    padding: 7px;
    display: block;
    border-top: 1px solid transparent;

        text-decoration: none;
}

.tran {
    background: rgba(120, 120, 120, .2);
}

.jMenu li ul li a.isParent {
   background: url('../images/tile_darker.png');
}

.jMenu li ul li a:hover {
    background: url('../images/tile_green.png');

}

UPDATED

I changed the css to have the background transparent not on the anchor but on the li:

.jMenu li ul li {
    background-color: #fff;
    display: block;
    background: rgba(0, 0, 0, .4);
    padding: 0;
}
War es hilfreich?

Lösung

It looks like you have a background image on all .jMenu li. Even though you think you are just applying this background ('.../images/tile_gray.png') to only the first level, it is leaking down into the inner <li>'s

Try adding background-image: none; to your child li:

.jMenu li ul li {
    background-color: #fff;
    background-image: none;
    display: block;    
    padding: 0;
}

This might work but it is hard to tell what exactly is going on without seeing it in action and without your HTML.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top