Home > Software design >  How can I make a it shown to the user on which site he is?
How can I make a it shown to the user on which site he is?

Time:03-29

If you're on the home website, I want it to make a different color, so u know you are on the Home site and not on the other sites. (Talking about the navbar) so that the Home has a different color as the others than white, and when u click on contact, the home button changes to white and contact changes from white.

Didn't get any idea how I could achieve this

CodePudding user response:

I guess you mean Home page. So make simple css class like

.active {
 color: YourColor
} 

After click set .active class to your html tag, and move on every element in each click.

CodePudding user response:

Is not clear if you want to change the color of the button (like @mrpbennett and @GrigorAtaryan saids) or wanna change the background of the whole navbar.

However, the basic solution is the same. Just add classes to differentiate the layout and then define CSS rules for those classes.

If you want to change the navbar background color when you are in Home, I would add a class in the body of the page, like

<body class = "homePage">

and in your CSS something like

.homePage .navBar {
     background-color: #yourcolor;
}

(assuming that .navBar is the class of you navbar)

  • Related