保持导航菜单固定在页面顶部(Weebly)

时间:2014-06-22 03:23:57

标签: css weebly

我在Weebly有一个网站,当您向下滚动时,模板会导致导航菜单跟随您,无论您在页面上的哪个位置都可以看到它。导航菜单会影响我的内容,所以如果我能将它保存在页面顶部会很棒。

我正在尝试将代码粘贴到此处,但它没有正确格式化,所以我会发布它的图像:

/* Navigation
--------------------------------------------------------------------------------*/
.nav {
    padding: 0 0 0 20px !important;
}
.nav ul{
    list-style: none;
    float:right;
    overflow: hidden;
}
nav ul li {
    list-style: none;
    float:left;
    margin-right:15px;
    padding:8px 15px;
    height:23px;
}
.nav ul li#active,
.nav ul li:hover {
    border:2px solid #fff;
    border-radius:4px;
    padding:6px 13px;
}
.nav ul li a {
    float:left;
    display: block;
    color:#fff;
    text-decoration:none;
    text-transform:uppercase;
    font-weight: 500;
    border: 0;
    outline: 0;
    list-style-type: none;
    font-size:14px;
    line-height:23px;
}
#nav-wrap .container ul li#active a,
#nav-wrap .container ul li a:hover {
    color: #fff;
    background: none !important;
    border: 0;
}
.landing-page:before,
.splash-page:before,
.tall-header-page:before,
.short-header-page:before {
    content: '';
    width: 100%;
    height: 130px;
    position: fixed;
    top: 0;
    left: 0;
    background: transparent url(‘menu-bg.png‘) left top repeat;
    z-index: 1;
}

1 个答案:

答案 0 :(得分:0)

我无法看到匹配的HTML,但我相信从页面底部的选择器中删除position: fixed可以解决您的问题。

您可以通过在每行之前添加四个空格来格式化代码,这很容易做到:选择记事本中的所有内容并按Tab键。