gpt4 book ai didi

css - 如何在水平 2 级 superfish 菜单中更正样式

转载 作者:行者123 更新时间:2023-11-28 11:47:54 25 4
gpt4 key购买 nike

我有一个水平的 superfish 菜单,有两层。当我将鼠标悬停在第一级链接上时,第二级下拉菜单看起来比顶级链接的底部低大约 2em,尽管 Firebug 说样式是:

.sf-menu li:hover > ul, .sf-menu li.sfHover > ul {
left: 0;
bottom: 0em;
}

无论我如何尝试提高底部位置(例如 bottom: -2.5em),二级菜单都不会升高。这让我认为浏览器 (Firefox) 可能会造成一个缺口,但我找不到这方面的证据。

我怎样才能改写这个不正确的定位或找出可能的原因?

最佳答案

你能发布一个链接到你的网站吗?

具体回答有点棘手....但作为猜测尝试定位:

.sf-menu ul a {

这是一些很好的、颜色清晰的 css 可以帮助你,掌握 superfish css 可能很棘手......

主题皮肤:

/*** COLOR SKIN ***/

/* main ul element */
.sf-menu {
border-right: 1px solid FUCHSIA;
float:left;
}

/* general link styles*/
.sf-menu a {
display: block;
padding:9px 13px;
text-decoration:none;
border-top: 1px solid;
border-left: 1px solid;
border-bottom: 1px solid;
}

/*** 1st Level ***/

/* 1st level links, no hover, no visits */
.sf-menu li a {
color: yellow;
background-color: green;
border-color: red;
}
/* 1st level links, while hovering over sub menu */
.sf-menu li.sfHover a{
color: black;
background-color: silver;
}

/* 1st level links, hover */
.sf-menu li a:hover {
color: white;
background-color: lime;
}

/* 1st level current page */
.sf-menu .current_page_item a,
.sf-menu .current_page_ancestor a,
.sf-menu .current_page_parent a {
border-bottom-color: white;
background-color: TEAL;
}

/* 1st level down triangles with pure css*/
.sf-menu li .sf-sub-indicator {
text-indent:-9999px;
line-height: 0;
border-color:YELLOW transparent transparent;
border-style:solid;
border-width:4px; /*controls size of triangle */
display:inline-block;
margin-left:5px;
}

/*** 2nd level ***/

/* sub menu */
.sf-menu ul {
border-right:1px solid;
border-bottom:1px solid;
border-color: yellow;
}
.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
top:32px; /* overriding essential styles- adjust if you have gaps between first level and drop-down sub menu*/
}
.sf-menu ul ul {
margin-top:0; /*unlikely to need adjusting */
}

/* 2nd level links, no hover */
.sf-menu li li a, .sf-menu li.sfHover li a {
color: orange;
background-color: blue;
border-color: green;
border-bottom: 0;
}

/* 2nd level links, while hovering over sub menu */
.sf-menu li li.sfHover a{
color: black;
background-color: silver;
}

/* 2nd level links, hover */
.sf-menu li li a:hover, .sf-menu li.sfHover li a:hover {
color: white;
background-color: aqua;
}

/* 2nd level current page */
.sf-menu li li.current_page_item a,
.sf-menu li li.current_page_ancestor a,
.sf-menu li li.current_page_parent a {
background-color: TEAL;
}

/* 2nd level side triangles with pure CSS */
.sf-menu li li .sf-sub-indicator { /*right arrow*/
border-color: transparent transparent transparent WHITE;
}

/*** 3rd Level and beyond ***/

/* 3rd level links, no hover */
.sf-menu li li li a, .sf-menu li.sfHover li li a {
color: blue;
background-color: red;
border-color: blue;
}

/* 3rd level links, hover */
.sf-menu li li li a:hover, .sf-menu li.sfHover li li a:hover {
color: white;
background-color: pink;
}

/* 2nd level current page */
.sf-menu li li li.current_page_item a,
.sf-menu li li li.current_page_ancestor a,
.sf-menu li li li.current_page_parent a {
background-color: TEAL;
}

关于css - 如何在水平 2 级 superfish 菜单中更正样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9365882/

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