代码:
a:link { color: #111111; }
a:visited { color: #1b3a57; }
a:hover { color: #f3371c; }
我的网站上有很多链接。并且这些状态与例如Footer文本(链接)和一般正文链接一起正常工作。但主导航链接和子标题链接不会改变状态。
我已经在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>
答案 0 :(得分:1)
如果您的HTML没有 DOCTYPE ,请尝试添加。(可能会工作......!)
由于不正确的DOCTYPES导致浏览器恢复到Quirks模式(IE)和CSS伪类不会 在这种情况下与DOM相处得很好。如需进一步阅读,请查看doctype and css relation as seen in alistapart.com