CSS阻止菜单项的悬停状态

时间:2012-08-21 13:20:40

标签: css html5 css3 hover onhover

可能是一个简单的解决方案,但我遇到了问题。我的悬停状态为我希望在一个大块的网站的主要导航。目前它只在当前链接上显示悬停选择器。我希望它在任一站点都有填充。

设计示例 - > http://www.garyrevell.co.uk/student-i/screenshot_01.jpg

这是当前的WIP网站。 http://www.garyrevell.co.uk/student-i/index.html

NAV css

    header nav {
    cursor:pointer;
    font-family: GeoSlb712XBdBT;
    text-transform:uppercase;
    float: left;
    color:#fff;
     /* WebKit (Safari/Chrome) Only */
     -webkit-text-stroke: 0.5px #F47B20;

     /* If we weren't using text-shadow, we'd set a         fallback color
     and use this to set color instead
    -webkit-text-fill-color: white; */

  color: white;

    text-shadow:1px 1px 0 #F47B20,
    /* Simulated effect for Firefox and Opera
       and nice enhancement for WebKit */
   -1px -1px 0 #F47B20,  
    1px -1px 0 #F47B20,
   -1px  1px 0 #F47B20,
    1px  1px 0 #F47B20;

    font-size:17px;
    text-align: right;
    padding-top: 5px;
    padding-bottom:5px;
    padding-left:2px;
    padding-right:2px;
    /*background-color: #ffffff;*/
    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.20)), to(rgba(255, 255, 255, 0.20)));
    background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.20));
    background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.20));
    background-image: -o-linear-gradient(top, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.20));
    background-image: -ms-linear-gradient(top, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.20));
    background-image: linear-gradient(top, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.20));
    filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#ffffff', EndColorStr='#ffffff');
    margin-top:15px;
    margin-left:20px;
    -webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;
    color:#FFFFFF;

    }
        header nav ul {
            list-style: none;
        }
            header nav li {
    float: left;
    margin: 0px 30px 0 30px;
            }

.navi {
    width: 500px;
    height:35px;
    padding: 0px;
    margin: 0px 0;
    overflow: hidden;
}
        .navi li {
                float: left;
                margin-right: 5px;
                list-style: none;
                color: #ffffff;
                outline: none;
                text-align: center;
                text-transform: uppercase;
                letter-spacing: 0;
                display: block; 
        }
            .navi li a {
                display:block;
                list-style: none;
                color: #ffffff;
                outline: none;
                text-align: center;
                text-transform: uppercase;
                letter-spacing: 0;
                display: block; 
                padding:3px;




            }

  .navi li:hover {


                background-color: #F47B20;
                color: #ffffff;



            }
            .navi li.current-menu-item {



            }

任何帮助都会很棒。非常感谢

2 个答案:

答案 0 :(得分:0)

添加此css

header nav { 
    padding:0; 
}

.navi {
    height: 40px;
}

.navi li{
    border-radius:5px;
    margin:0;
    padding:0 20px;
}

.navi li a{
    line-height:40px;
}

答案 1 :(得分:0)

.navi li {
     line-height: 30px;
     border-radius: 7px;
     margin-left: 20px
}

.navi li a{
     padding: 0 15px;
}

.navi li:hover {
    background-color: #F47B20;

}

将这些属性添加到现有代码中,(不要只替换add)