如何调整下拉菜单的位置?

时间:2013-08-30 16:16:24

标签: css drop-down-menu navigation position submenu

我想在navigation links上调整下拉菜单的位置。我尝试调整“nav .folder ul li a”,但我无法移动它。我想把它的位置下调大约10px。

CSS:

body .main-nav li > a,
body .main-nav li > a:visited {
    color: #3b5998;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out; }

#nav a:hover {
    border-top: solid 4px #b7c3e6;
    color: #b7c3e6;
 }

.header-alignment-left.header-navigation-split #topNav { position:absolute; right: 0px }

.logo-image #topNav nav li a { padding:4px 15px; line-height: 100% }

#nav a { border-top: 4px solid transparent }

#nav .subnav { margin-top: 4 }

#nav a { border-right:0px solid #3b5998; height: 20px }

#nav li:last-child a { border-right: 0 }

#topNav nav .folder ul li a {
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out }

#header #topNav nav .folder ul li {
    padding: 0 24px 12px;
    position: relative; }

#header { margin-top: 20px !important }

#topNav { margin-top: 40px }

#nav .subnav ul { padding-bottom: 15px !important }

#nav .subnav ul { padding-top: 15px !important }

3 个答案:

答案 0 :(得分:1)

#topNav nav .folder .subnav div的绝对值最高为100%。如果将其更改为px值(例如45px),则可以移动它。

#topNav nav .folder .subnav {
    position: absolute;
    top: 45px;
    left: 0px;
    background: #ffffff;
    height: 0;
    overflow: hidden;
    opacity: 1;
    z-index: 999;
}

编辑:结束后离开上面的内容并添加

#topNav nav li.folder {
  height: 32px;
}

答案 1 :(得分:0)

尝试将margin-top: 10px;添加到nav .folder ul

答案 2 :(得分:0)

margin-top: 10px;添加到#topNav nav .folder ul