CSS导航问题
我的主页现在有两个问题
第一当我将鼠标悬停在管理上,然后转到子项目之一时,字体颜色变为灰色。
第二,我不知道如何使用颜色 #ffffff 让子项目的背景变得透明 80%。我希望紫色保留在主要物品中,直到你离开它为止。
有人可以帮我吗?
I have two problems with my Page right now
1st when I hover over administration, then go down to one of the sub items the font color turns gray.
2nd I cant figure out how to get the background of the sub items to be transparent at 80% using the color #ffffff. I want the purple to remain in the main item until you leave it.
Can anyone help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
[jsfiddle 更新]
1) 使用适当的 CSS 选择器管理此操作:
含义是:“选择立即 <悬停在 li.border 的 code>a 子级(即菜单标题)上,并选择悬停在 ul.sub-level 下的所有
a
元素2) 我是。不确定我正确理解您想要的内容 - 我的更新满足您的需求吗?我添加了一些透明度,并且还添加了
-moz-opacity: 0.6;
以实现跨浏览器兼容性。[jsfiddle update]
1) Managed this using appropriate CSS selectors:
The meaning is: "Select the immediate
a
child of li.border when hovered over (that's the menu title) and also select alla
elements under ul.sub-level that are hovered over.2) I'm not sure I understood correctly what you wanted - does my update suit your needs? I added a bit of transparency and I also added
-moz-opacity: 0.6;
for cross-browser compatibility.第一个与你的悬停有关。当您将鼠标悬停在该项目上时,其文本会变成白色。然后,您将鼠标悬停在子项目上,而不是再悬停在项目本身上,因此显然它会变回其“默认”颜色,即灰色。您可以使用 javascript 修复此问题,方法是向项目和子项目所属的整个边框添加 onmouseover="" ,并让 javascript 将颜色设置为白色,而不仅仅是 CSS。不确定仅使用 CSS 是否可以实现这一点。
第二个我想我有一个想法。我认为不可能只使背景透明,而只需为 IE 的子项目的 div 设置 0.8 或 80 的不透明度,并为文本创建一个 div,将不透明度设置为 100。
希望有帮助?
The first one has to do with your hover. When you hover over the item its text turns white. You then hover over the subitem, not over the item itself anymore, so obviously it turns back to its 'default' color which is gray. You could fix this with javascript, by adding a onmouseover="" to the entire border of which the item and subitems are part, and letting javascript set the color to white instead of only CSS. Not sure if this is possible with only CSS.
The second one I think I have an idea. I don't think its possible to just make the background transparent, but just give the div of the sub items an opacity of .8 or 80 for IE and create a div for just the text with the opacity set to 100.
Hope that helps?