按钮衬垫太大



我一直试图更改CSS中的所有属性,以解决当前导航栏按钮的问题,但没有成功。

当鼠标悬停在上面时,按钮超过了导航栏背景的高度,这是不应该的

http://www.mohrdevelopment.com

我的HTML:

            <ul class="navigation">
                <li class="current"><a href="index.html"><em class="home"/>Home</b></a></li>
                <li><a href="second.html"><em class="photos"/><b>Photos</b></a></li>
                <li><a href="projects.html"><em class="projects"/><b>Projects</b></a></li>
                <li><a href="about.html"><em class="about"/><b>About</b></a></li>
                <li><a href="contact.html"><em class="contact"/><b>Contact</b></a></li>
            </ul>

我的CSS:

body {
        font-family:sans-serif;
        background: url(images/background3.png);
    }
    .navigation {
        background:#1841c8 url(Navigation/Navigation/nav_background.png);
        height:40px;
        margin-bottom:0px;
        font-size: 0; /*remove whitespace*/
        display:block;
        min-width:625px;
    }
    .navigation li{
        display:inline-block;
        line-height: 40px;
        font-size:16px;
            }
    .navigation li a{
        display:block;
        color:#FFFFFF;
        padding: 11px 5px 15px;
    }
    .navigation li a em{
        height:32px;
        display:inline-block;
        padding: 0 5px 6px 50px;
        font-weight:bold;
        vertical-align: middle;
        background-position: 0 50%;
        font-size:16px;
    }
    .navigation li a:hover{
        color:#00CCFF;
        background: url(Navigation/Navigation/nav_hover.png);
        text-decoration:none;
        padding: 11px 5px 10px;
    }
    .navigation .current a {
        color:#FFFFFF;
        background:url(Navigation/Navigation/nav_hover.png);
        padding-bottom:11px;
    }

    /*Navigation bar icons*/
    .navigation li a em.home {
        background-image: url(Navigation/Icon_images/home.png);
        background-repeat: no-repeat;
    }
    .navigation li a em.photos{
        background-image: url(Navigation/Icon_images/Photo.png);
        background-repeat: no-repeat;
    }

    .navigation li a em.projects{
        background-image: url(Navigation/Icon_images/projects.png);
        background-repeat: no-repeat;
    }

    .navigation li a em.about{
        background-image: url(Navigation/Icon_images/about.png);
        background-repeat: no-repeat;
    }
    .navigation li a em.contact{
        background-image: url(Navigation/Icon_images/Contact.png);
        background-repeat: no-repeat;
    }
    a {
      Color:blue;
      Text-decoration:none;
    }
    h1 {
        background: url(images/Header.png);
        text-indent:-9999px;
        width:1092px;
        height:132px;
        margin:auto;
    }

    .content, aside {
        height:600px;
    }
    .wrap {
          margin:auto;
          width:80%;
          background:yellow;
        }
    .content {
        background:teal;
        float:left;
        width:80%;
        height:auto;
        min-width:500px;
        display:inline;
    }
    aside {
        background:lightblue;
        float:left;
        width:20%;
        min-width:125px;
        display:inline;
    }
    aside ul {
        padding-left:1px;
        list-style:none;
    }

    ul a {
        text-decoration:none;
        color: #666;
    }
    ul a:hover {
        text-decoration:underline;
        color:black;
    }
    .sidebarli {
    }
    li {
        list-style:none;
        margin-bottom:20px;}
    label {
        display: block;
        cursor: pointer;
        color: #292929;
        font-family:sans-serif;
        padding-bottom:8px;
    }
    form ul {padding-left:0px;
    }
    textarea {
        width:400px;
        height:220px;
    }

我认为问题在于Navigation/Navigation/nav_hover.png图像。您正在将repeat应用于背景图像。

请使用

.navigation li a:hover 
{
    background: url("Navigation/Navigation/nav_hover.png") **no-repeat** scroll 0 0 transparent;
    color: #00CCFF;
    padding: 11px 5px 10px;
    text-decoration: none;
}

在style.css.中

让我知道这是否解决了问题。

您可以调整A元素上的填充:

.navigation li a {
  padding: 2px 5px;
}

此外,您的"em"标签应该关闭。你有打开的"em"标签,但没有关闭的"/em"标签。

相关内容

  • 没有找到相关文章

最新更新