gpt4 book ai didi

css - jmenu - 子菜单元素的透明度

转载 作者:太空宇宙 更新时间:2023-11-04 15:04:51 26 4
gpt4 key购买 nike

我正在使用 jmenu.js 并将子菜单元素设置为具有透明度。问题是具有透明度的子元素显示父元素(即主菜单栏)的背景。我想要的是在显示到页面背景的子菜单上具有透明度。 CSS 是:

.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');

}

已更新

我更改了 css 使背景透明,但不是在 anchor 上而是在 li 上:

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

最佳答案

看起来您在所有 .jMenu li 上都有背景图片.即使您认为您只是将此背景 ('.../images/tile_gray.png') 应用到第一层,但它正在泄漏到内部 <li>

尝试添加 background-image: none;给你的 child 李:

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

这可能行得通,但如果没有看到它的实际效果并且没有您的 HTML,很难说出到底发生了什么。

关于css - jmenu - 子菜单元素的透明度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16006682/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com