Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3455200
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:35:07+00:00 2026-05-18T09:35:07+00:00

I have an HTML menu in a partial and I want to make the

  • 0

I have an HTML menu in a partial and I want to make the menu items dynamic (changing colors) depending on which page we are at. How can I do that?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:35:08+00:00Added an answer on May 18, 2026 at 9:35 am

    A common trick that is used to alter the appearance of menus to reflect the current page is to put a CSS selector or class that reflects the page name in the body tag.

    Once you’ve done that, you can create different styles for each variation of page name that you want.

    For example:

    <!-- @page_name is 'home' in this example -->
    <body class="<%= @page_name %>">
    
      <!-- Lots of html here -->
    
      <div class="nav_links">
        <ul id="nav">
          <li class="home"><a href="/"><span>Home</span></a></li>
          <li class="about_us"><a href="/about"><span>About us</span></a></li>
          <li class="store"><a href="/store"><span>Shop</span></a></li>
        </ul>
      </div>
    

    Then the CSS can be anything you like, but something like:

    body.home div.nav_links ul li.home { /* blah blah */ }
    body.about_us div.nav_links ul li.about_us { /* blah blah */ }
    

    This method ensures good separation of concerns: the visual styles (changing of your colors) stay in your stylesheets, and out of your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a livesearch script that i need to populate my html menu with
In menu.html, I have my menu items(a href links), let's call them, menu_1, menu_2,
I have a vertical menu in my system which is basically made of HTML
I have been trying to make the sub-menu horizontal. In my HTML it looks
I have a menu (jquery-ui accordion with Html.ActionLink as menu options). How can I
I have navigation menu using images, I want that if the user click a
I have following HTML menu: <ul> <li><a href=index.html>Index Page</a></li> <li><a href=#some-page>Some Page</a></li> </ul> Let
My problem is: I have a drop down menu and i want that when
I have a simple navigation menu with plain html links that target different pages.
I have an html menu, when one item from it gets clicked I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.