Jump to content

Recommended Posts

The following image is what my menu is supposed to look like and what it usually does look like.

 

picture6kr4.png

 

The next image is what it looks like sometimes, it's seemingly random and I have no idea why it would do it because when checking the source, the html appears like it should be with the list items but they don't appear.

 

picture5cb6.png

 

Here's the code I'm using, maybe you can figure out why it's happening.

 

<div id="menu">
		<ul>
			<li<?php echo($page == 'Home' ? " class=\"current\"" : ""); ?>><a href="index.php"><b>Home</b></a></li>
			<li<?php echo($page == 'About' ? " class=\"current\"" : ""); ?>><a href="about.php"><b>About</b></a></li>
			<li<?php echo($page == 'Page1' ? " class=\"current\"" : ""); ?>><a href="page1.php"><b>Page 1</b></a></li>
			<li<?php echo($page == 'Page2' ? " class=\"current\"" : ""); ?>><a href="page2.php"><b>Page 2</b></a></li>
			<li<?php echo($page == 'Contact' ? " class=\"current\"" : ""); ?>><a href="contact.php"><b>Contact</b></a></li>
		</ul>
	</div>

#menu ul {margin:0 auto; padding:0; list-style:none; display:table; white-space:nowrap; list-style:none; height:2em; position:relative; font-size:0.9em;}
#menu li {display:table-cell; margin:0; padding:0;}
#menu li a {display:block; float:left; height:2em; line-height:2em; color:#333; text-decoration:none; font-family:arial, verdana, sans-serif; font-weight:bold; text-align:center; padding:0 0 0 12px; cursor:pointer; background:url('menu/0a.gif') no-repeat;}
#menu li a b {float:left; display:block; padding:0 12px 0 0; background:url(menu/0b.gif) no-repeat right top;}
#menu li.current a {color:#000; background:url(menu/2a.gif) no-repeat;}
#menu li.current a b {background:url(menu/2b.gif) no-repeat right top;}
#menu li a:hover {color:#000; background: url(menu/1a.gif) no-repeat;}
#menu li a:hover b {background:url(menu/1b.gif) no-repeat right top;}
#menu li.current a:hover {color:#000; background: url(menu/2a.gif) no-repeat; cursor:default;}
#menu li.current a:hover b {background:url(menu/2b.gif) no-repeat right top;}

Link to comment
https://forums.phpfreaks.com/topic/116559-menu-items-dissapear-randomly/
Share on other sites

Hi,

 

Why don't you try:

 

<div id="menu">

<ul>

<li><?php echo($page == 'Home' ? " class=\"current\"" : ""); ?>><a href="index.php"><b>Home</b></a></li>

<li><?php echo($page == 'About' ? " class=\"current\"" : ""); ?>><a href="about.php"><b>About</b></a></li>

<li><?php echo($page == 'Page1' ? " class=\"current\"" : ""); ?>><a href="page1.php"><b>Page 1</b></a></li>

<li><?php echo($page == 'Page2' ? " class=\"current\"" : ""); ?>><a href="page2.php"><b>Page 2</b></a></li>

<li><?php echo($page == 'Contact' ? " class=\"current\"" : ""); ?>><a href="contact.php"><b>Contact</b></a></li>

</ul>

</div>

 

Maybe that will work, as everything else looks fine.

 

~Py

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.