Forums

Keeping a nav button highlighted to indicate the page your on... (5 posts)

  1. shorn
    Member
    Posted 6 years ago #

    Hi all,

    I am currently trying to develop my own theme. I have started off with an existing theme and I am slowly going through and trying to modify it to suit my design.

    One thing im stuck with is how to make my horizontal nav button stay highlight when the user is on that page.
    My site is here

    And if you scroll over teh horizontal nav bar the colour changes to a black gradient.
    I would like whatever button it is to stay in teh hover over colour when a user clicks on teh page to show the user what page they are on... i hope this makes sense?

    Any help appreciated!

    The css for the nav section is as follows.

    .navigation {
    background:#d7d7d7 url('img/nav.jpg');
    height: 28px
    }
    .navigation a {
    background: #d7d7d7 url('img/nav.jpg');
    border-right: 4px solid #d7d7d7;
    color: #fff;
    display: block;
    float: left;
    text-decoration: none;
    font: bold 1em sans-serif;
    line-height: 28px;
    padding: 0 20px;
    }
    .navigation a:hover {background-position: left bottom; color: #fff; text-decoration: underline}

  2. jetshack
    Member
    Posted 6 years ago #

  3. jabecker
    Member
    Posted 6 years ago #

    You might want to check out this article: http://codex.wordpress.org/Dynamic_Menu_Highlighting

  4. dwzemens
    Member
    Posted 6 years ago #

    If you are using wp_list_pages() to make your navigation links dynamically related to your WordPress pages, then this article will explain what the applied CSS is. This will allow you to highlight the current page, which will have the CSS markup of "current_page_item" applied to the navigation element.

    It appears as though you are not using this function to dynamically write your navigation menu. Check out the page that defines the function and you will see how worthwhile it is to use it.

    http://codex.wordpress.org/Template_Tags/wp_list_pages

    dz

  5. jetshack
    Member
    Posted 6 years ago #

    great links jabecker and dwzemens... I've been looking for those for a while.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.