mehdi mehdi - 1 year ago 164
CSS Question

How to highlight active page in a masterpage menu?

I have a menu inside a

(in a ASP.NET Web site), and i want to highlight active page in masterpage menu and submenus.


<ul id="nav" class="sf-menu">
<li class="current-menu-item"><a href="index.html">Home</a></li>
<li><a href="page.html">menu-2</a>
<li><a href="page-full.html">full</a></li>
<li><a href="page-features.html">featurs</a></li>
<li><a href="page-typography.html">typography</a></li>


color: #fe8300;

thanks in advance.

Answer Source

finally i solved my problem with using jQuery:

    var str=location.href.toLowerCase();
    $("#nav li a").each(function() {
        if (str.indexOf($(this).attr("href").toLowerCase()) > -1) {
        if ($(this).is("li")){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download