【问题标题】:hover box on navigation menu导航菜单上的悬停框
【发布时间】:2013-06-05 03:29:44
【问题描述】:

所以我想添加一个悬停框,就像我当前在活动链接“主页”上设置的那个到其他链接但是当我尝试添加它时,导航菜单会在我悬停时移动位置,所以我希望一些帮助。

http://trulyamped.com/test/index.html
http://trulyamped.com/test/styles.css

只需查看源代码,让我知道我需要修复什么。

谢谢大家。

此外,我还想知道当您将鼠标悬停在菜单项上时添加轻微的延迟/淡入淡出。例如:就像我将鼠标悬停在“联系人”上,它变成蓝色,但是当我悬停时,它需要半秒或其他时间才能消失。

再次感谢

【问题讨论】:

    标签: html navigation hover nav


    【解决方案1】:

    变化:

    LN9:移除

    LN12:内边距:0px 24px;

    LN25-28:更新悬停

    LN36-36:移除

    LN77-78:移除

    body {
        margin: 0px;
        padding: 0px;   
    }
    header {
        height: 95px;
        background-color: #fff;
    }
    
    a {
        text-decoration: none;
        padding: 0px 24px;
    }
    a:link    {
        color:inherit;
        text-decoration: none;
    
        }
    a:visited  {
        color:inherit;
        text-decoration: none;
        }
    a:hover    {
        text-decoration: none;
        background-color: #FF6850;
        padding-top: 38px;
        padding-bottom: 34px;
        color: white;
    }
    a:active   {
        color:inherit;
        text-decoration: none;
    
        }
    a.active{
        background-color: #FF6850;
        padding-top: 38px;
        padding-bottom: 34px;
        color: white;
    }
    
    #longbar {
        min-width: 1000px;
        width: auto;
        clear: both;
        height: 8px;
        background-color: #fff;
        background-image: url(images/header/topbar.jpg);
    }
    #longbarmini {
        min-width: 1000px;
        width: 100%;
        clear: both;
        height: 3px;
        background-color: #FF6850;
    }
    #wrapper {
        width: 1000px;
        margin-right: auto;
        margin-left: auto;
    }
    #wrapper header h1 {
        font-family: 'Titillium Web', sans-serif;
        margin: 0px;
        padding-top: 16px;
        padding-left: 20px;
        color: #0078D4;
        float: left;
        font-size: 40px;
    }
    #wrapper header h1 span {
        color: #316ca7;
        font-weight: lighter;
    }
    #wrapper header ul {
        list-style-type: none;
        float: right;
        padding-top: 20px;
        font-family: 'Source Sans Pro', sans-serif;
        font-weight: lighter;   
        font-size: 18px;
    }
    #wrapper header ul li {
        display: inline;
        color:inherit;
        text-decoration: none;
    
    }
    
    section {
        width: 100%;
        min-width: 1000px;
        height: 400px;
        background-color: #AE4639;
    }
    #content {
        height: 100px;
        width: 800px;
        margin-right: auto;
        margin-left: auto;
        background-color: #0FF;
    }
    footer  {
        min-width: 1000px;
        clear: both;
        height: 45px;
        background-color: pink;
    }
    

    【讨论】:

    • 谢谢,但如果我想增加颜色的宽度怎么办?喜欢左右?
    • 顺便问一下,您询问了悬停延迟。您可以使用 javascript 来制作此动画。 jquery有一个例子:tympanus.net/Tutorials/UIElements/LargeDropDownLN189-215
    • 非常感谢,我看到错误出现在我的 padding-right 和单词间距上——我总是做这样的事情,然后我找不到那个错误。谢谢术士。生病看看你发给我的 jquery 链接,我之前正在寻找一个,但只是遇到了一堆其他的东西。再次感谢
    • 不是什么大不了的事,但是......你知道如何减少悬停和活动之间的空白吗?
    • 这是一个很好的问题,在另一个线程中被问到:stackoverflow.com/questions/4716151/…
    猜你喜欢
    • 2015-11-12
    • 2013-04-09
    • 2023-03-03
    • 1970-01-01
    • 2016-01-07
    • 2019-11-27
    • 1970-01-01
    • 1970-01-01
    • 2014-05-19
    相关资源
    最近更新 更多