Jump to content
  • 0

Navigation Bar with Current Selection Color




How can I make my navigation have a different color for current selection ?

Here is my script :

  padding: 0;
  list-style-type: none;
  overflow: hidden;
  background-color: #63F28E;
li {
  float: left;
ul li {
  font: 120% "Arial", Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;

li a {
  background: #63F28E;              /*BOX COLOR IJO*/
  #border-bottom: 1px solid #000000;
  color: #FA0616;                   /*TEXT COLOR MERAH*/
  display: block;
  #margin: 0;
  padding: 15px 12px;               /*HEIGHT BOX*/
  text-decoration: none;

ul a:hover {
  background: #68E4E4;              /*Hovered BOX Color BIRU*/
  color: #fff;                      /*Hovered TEXT Color PUTIH*/
  text-shadow:#ffffff 0px 0px 5px;  /*Text Glow*/
  padding-bottom: 15px;             /*HEIGHT HOVER BOX*/

<ul class="menu-list">
  <li><a class="active" href="#home">Home</a></li>
  <li><a href="#news">News</a></li>
  <li><a href="#contact">Contact</a></li>
  <li><a href="#about">About</a></li>
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

I'm guessing you have this same navigation bar on all 4 of the pages, being: Home, News, Contact, and About.

You already have the "active" class, which is set on the Home link.

In your CSS styles, add something like this, and change the "background-color" to whatever color you want:

.active {
  background-color: green;

Simply change the link that has the "active" class to the page you have put the navigation bar on. In example, when you paste this navbar onto the News page, remove the active class from Home and put it on News. Do that for the rest of your pages.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...