Jump to content

Text Won't Show Up As Black


Recommended Posts

I have this CSS (part of):

#topnav ul{margin-left: 140px;padding:0 5px;font-size:15px;color:#3366cc;overflow:hidden;list-style-type: none;}#topnav ul li a{float:left;padding:8px;text-align: left;font-family: Tahoma, Arial, Helvetica, sans-serif;font-size: 15px;text-decoration: none;color: #999;}#topnav ul li a:hover{color: black;cursor:pointer;}#topnav ul .current{font-weight:bold;color: black;}

It all works exept one: #topnav ul .current won't show as black. Any ideas?

Link to post
Share on other sites

if the text is within a anchor it will follow this rule

#topnav ul li a{float:left;padding:8px;text-align: left;font-family: Tahoma, Arial, Helvetica, sans-serif;font-size: 15px;text-decoration: none;color: #999;}

the

#topnav ul .current{font-weight:bold;color: black;}

will only take effect if the anchor is the element with class current, and is below the previous ruling

  • Like 1
Link to post
Share on other sites

This is the menu:

<div id="topnav">  <ul>   <li <?php if($current == 'index') { echo 'class="current"'; } ?>><a href="index.php">Introductie</a></li>   <li <?php if($current == 'constructie') { echo 'class="current"'; } ?>><a href="constructie.php">Constructiewerk</a></li>   <li <?php if($current == 'snijtechniek') { echo 'class="current"'; } ?>><a href="snijtechniek.php">Snijtechniek</a></li>   <li <?php if($current == 'laadenlossystemen') { echo 'class="current"'; } ?>><a href="laadenlossystemen.php">Laad- en lossystemen</a></li>   <li <?php if($current == 'projecten') { echo 'class="current"'; } ?>><a href="projecten.php">Projecten</a></li>   <li <?php if($current == 'certificering') { echo 'class="current"'; } ?>><a href="certificering.php">Certificering</a></li>   <li <?php if($current == 'contact') { echo 'class="current"'; } ?>><a href="contact.php">Contact</a></li>  </ul></div>

When an menu item is selected the item does show up as bold. For some reason the color is not changed.

Link to post
Share on other sites

because #topnav ul .current{font-weight:bold;color: black;} will change all text in li with class 'current' to bold and and color black, but #topnav ul li a{ float:left;padding:8px;text-align: left;font-family: Tahoma, Arial, Helvetica, sans-serif;font-size: 15px;text-decoration: none;color: #999;} change the text color to #999 as it will overide the color set for li it should be

#topnav ul .current a{font-weight:bold;color: black;} 

Edited by dsonesuk
Link to post
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.

Guest
Reply to this topic...

×   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.

Loading...
×
×
  • Create New...