garry Posted July 25, 2008 Share Posted July 25, 2008 The following image is what my menu is supposed to look like and what it usually does look like. 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. 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;} Quote Link to comment https://forums.phpfreaks.com/topic/116559-menu-items-dissapear-randomly/ Share on other sites More sharing options...
haku Posted July 25, 2008 Share Posted July 25, 2008 Have you validated your code? Everything you have there looks fine, so I'm wondering if it is a result of an error earlier up in the code. Quote Link to comment https://forums.phpfreaks.com/topic/116559-menu-items-dissapear-randomly/#findComment-599506 Share on other sites More sharing options...
Pyro Posted July 26, 2008 Share Posted July 26, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/116559-menu-items-dissapear-randomly/#findComment-600152 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.