0

代码:

a:link { color: #111111; }
a:visited { color: #1b3a57; } 
a:hover { color: #f3371c; }

我的网站上有很多链接。这些状态可以很好地处理,例如,页脚文本(链接)和一般正文链接。但是主导航链接和子标题链接不会改变状态。

我在 IE 5+、Chrome、Opera、Safari、Maxthon 和 FireFox 中进行了测试,但得到了相同的结果。

什么可能导致这种行为?


更新:

标头代码:

#Header {
    width: 100%;
    height: 120px;

    background-image: url('/Shared/Assets/Images/OrangeDot.png');
    background-position: center bottom;
    background-repeat: repeat-x;

}

    #Header #MainLogo {
        float: left;
    }

子标题代码:

#SubHeader {
    width: 100%;
    height: max-content;
}
    #SubHeader ul {
        float: left;
        margin: 20px 0 0 0;
    }
        #SubHeader ul li img {
            line-height: 1.5em;
            margin: -.30em 0;
        }
        #SubHeader ul li {
            padding: 0 10px 0 10px;

        }
            #SubHeader ul li a {
                font-size: small;
                /*color: #f3371c;*/
            }


HTML 标记:

        <ul id="MainNavigation" class="HorizontalMenu WithBullets">
            <li><a class="HighlightedMenuOption" href="@Href("~/Home")">Home</a></li>
            <li><a href="@Href("~/Protected/Account/")">Sign In | Register</a></li>
            <li><a href="@Href("~/Shared/Support/")">Support</a></li>
            <li><a href="@Href("~/Shared/")">About Us</a></li>
            <li><a href="@Href("~/Shared/")">Contact Us</a></li>
        </ul>
    </div>
    <div id="SubHeader">
        <div id="categories" class="s_nav">
            <ul>
              <li id="menu_home"> <a href="@Href("~/Home")">Home</a> </li>
              <li> <a href="@Href("~/Shared/Products/")"></a>
                <div class="s_submenu">
                  <h3>Categories</h3>
                  <ul class="s_list_1 clearfix">
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                  </ul>
                  <span class="clear border_eee"></span>
                </div>
              </li>
              <li> <a href="@Href("~/Shared/Products/")"></a>
                <div class="s_submenu">
                  <h3>Categories</h3>
                  <ul class="s_list_1 clearfix">
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                  </ul>
                  <span class="clear border_eee"></span>

                </div>
              </li>
              <li><a href="@Href("~/Shared/Products/")"></a>
                <div class="s_submenu">
                  <h3>Categories</h3>
                  <ul class="s_list_1 clearfix">
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                  </ul>
                  <span class="clear border_eee"></span>
                </div>
              </li>
              <li><a href="@Href("~/Shared/Products/")"></a>
                <div class="s_submenu">
                  <h3>Categories</h3>
                  <ul class="s_list_1 clearfix">
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                  </ul>
                  <span class="clear border_eee"></span>
                </div>
              </li>
              <li><a href="@Href("~/Shared/Products/")">Tek Screws</a>
                <div class="s_submenu">
                  <h3>Categories</h3>
                  <ul class="s_list_1 clearfix">
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                    <li><a href="@Href("~/Shared/Products/")"></a></li>
                  </ul>
                  <span class="clear border_eee"></span>
                </div>
              </li>
            </ul>
          </div>
4

1 回答 1

1

如果您的 HTML 没有DOCTYPE ,请 尝试添加它。(可能工作......!)

由于不正确的 DOCTYPES 会导致浏览器恢复到 Quirks 模式(IE),并且 CSS 伪类在这种情况下不会与 DOM 相处得很好。如需进一步阅读,请查看alistapart.com中的doctype 和 css 关系

于 2012-09-17T10:42:32.637 回答