By Mateo on
Visit a site I am working on:
Be sure to view it in both firefox and IE.
The primary links work fine in firefox but are doing a "step" pattern in IE.
Here is the code from page.tpl.php
?php if (is_array($primary_links)) : ?>
<div id="navigation"><h3 class="hidden">Navigation</h3>
<ul>
<?php foreach ($primary_links as $link): ?>
<li><?php print $link?></li>
<?php endforeach; ?>
</ul></div>
<?php endif; ?>
And the code from style.css
/*THIS PART IS FOR THE NAVIGATION LINKS*/
/*.nav1 a:link, .nav1 a:visited, .nav2 a:link, .nav2 a:visited, .nav3 a:link, .nav3 a:visited{*/
#navigation li a:link, #navigation li a:visited {
color: #FFFFFF;
width: 80px;
height: 20px;
line-height: 20px;
background-color: #29911B;
padding: 0;
float: left;
display: block;
margin-right: 3px;
}
/*HOVER EFFECTS*/
#navigation li a:hover, #navigation li a:active {
background-color: #FFFFFF;
margin: 1px 3px 0 0;
color: #4E4E4E;
}
Can anyone help me fix this so that it appears the same in both browsers? As much as I hate IE, 95% of the world is still using it.
Thanks in advance.
Comments
try display:inline
Off the top of my head, I'd suggest trying two tweaks. First, try display:inline rather than display:block. If that doesn't fix it, drop the float:left attribute. If neither of these tweaks do the job... well, someone else will probably come along with the solution. But if not, post again only this time include the css for #navigation and/or #navigation .ul as these may be affecting the output too.
IE will usually obey you on li based menus... with a bit of coaxing.
Tag Change
If IE is having an issue with UL tags give DL a try. This may not work if IE considers both tags the same, but it is an interesting way to build up a list without the need to dump bullets, spacing, etc.
Let me know if you have any success.
We have a winner
using the DL and DT tags in combination with the display: inline worked.
YAY for drupal.
Thanks guys, seriously. I was about to pull my hair out.
A Winner
Glad the change of tags worked.
This tag set is called a definition list with DL, DT and DD tags. It is interesting to work with and can solve some of the issues that IE brings to page design as in your case. It just seems easier to use than UL LI in some applications.
Good luck with the site and I see that it is now working in IE.
Jim
It would've been "better" to
It would've been "better" to stick with UL and remove the floating, not switch to using an ill-fitting (and incomplete) definition list.
demolicious | leafish
Cheers - DL: who would have thunk it?
You just saved me a lot of greif.
Thanks!
Try:
Try:
#navigation li { display:inline }
... instead of applying the display rule to "li a". It's the list item that you want displayed inline, not the links inside.
Also, remove the float and try it without specifying a width or height. If you really want to float this list, do it to the "ul" tag, not the links.
demolicious | leafish
reverse now occuring
please ignore... it's fixed now. YAY!
Thanks a lot for that...
Thanks a lot for that... saved me from a lot of head scratching.
See Also...
http://css.maxdesign.com.au/listamatic/
Plenty of examples with source code. Horizontal & Vertical, Nested & Non-Nested.