471,336 Members | 1,239 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,336 software developers and data experts.

Newbie Problem: Menu not aligned in IE6

it was perfectly in firefox but not getting right in IE.........
its css is.....
#region_header {
left: 10px;
top: 2px;
margin: 0px;
padding: 0px;
width: 468px;
height: 20px;
border: none;
color: #fff;
Aug 21 '07 #1
9 2563
173 Expert 100+

This is possibly due to the differences in the box model between Firefox and IE. Check that the HTML validates and that you use a doctype so that IE is not in quirks mode.

If these do not help please submit either a URL where the problem can be seen or the HTML so that the problem can be reproduced
Aug 21 '07 #2
http://ebizontech.vpsland.com/menu_t...efox/page.html in the link you can see the difference......................in firefox and IE.............please help me
Aug 21 '07 #3
173 Expert 100+
The page currently has 26 errors. The validation result can be seen here

The PHP script does not seem to be working and your server side code for the screen printing is being sent to the client.

Fix these issues first, I will continue looking at this to see if there are any other issues that I can see.
Aug 21 '07 #4
173 Expert 100+
Having looked at the source code, the reason that the PHP code is not executing is because the opening and closing tags ("<", ">") are being URL/HTML encoded so they are not being parsed correctly on the server side and therefore not being executed
Aug 21 '07 #5
The page currently has 26 errors. The validation result can be seen here

The PHP script does not seem to be working and your server side code for the screen printing is being sent to the client.

Fix these issues first, I will continue looking at this to see if there are any other issues that I can see.
Thanks phpvfl. I have valided my html agains the validator of w3 and have also removed all php codes. Now please help to get the menu items working on IE. (it is working with firefox).
Aug 21 '07 #6
173 Expert 100+

I have managed to determine that the absolute positioning on the ul is not being applied the same in FF and IE, however it is going to take some time to determine the active styles on the tabs due to the amount of CSS. There are 23 different selectors that match with the tabs (granted this is including inheritance), so it will take some time trying to get my head around this.
Aug 23 '07 #7
533 Expert 512MB
Hi there,

This is a fairly simple solution which I use in my websites - I copy my base stylesheet (style.css) and rename it with a two-digit browser identifier (so style_ie.css would be for Internet Explorer, style_ff.css for Firefox etc.).

Then you use some Javascript to identify which browser the client is using and subsequently insert the relevant <link> tag into your page (like below:)
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. <!--
  3. switch (navigator.appName.substr(0,5)){
  4.     case "Micro":    
  5.         document.write('<link rel="stylesheet" type="text\/css" href="style_ie.css" \/>');
  6.         break;
  7.     case "Netsc":
  8.         document.write('<link rel="stylesheet" type="text\/css" href="style_ff.css" \/>');
  9.         break;
  10.     case "Opera":
  11.         document.write('<link rel="stylesheet" type="text\/css" href="style_op.css" \/>');    
  12.         break;
  13.     default:
  14.         document.write('<link rel="stylesheet" type="text\/css" href="style.css" \/>');
  15.         break;
  16. }
  17. //--></script>
The problem I generally find is that FF and IE are about 5 pixels horizontally and 3 pixels vertically out of sync with each other (which isn't surprising lol) - however Opera, funnily enough, is almost identical to IE!
If you're using script in your page, you should also export your JScript to separate files and use this section to import that script for different browsers (such as image/menu rollovers, AJAX etc.).

Note the default option - should your script not recognise the user's browser (for example, some specialist screen reading browsers - or maybe just Lynx lol), your page serves up a stylesheet (and JScript if you should so choose) that conforms to the W3C CSS2 classification, covering your bases.

Hope this helps!

Aug 23 '07 #8
7,435 Expert 4TB
Differences in spacing around elements are sometimes caused by different default margin/padding between browsers. It is frequently best to set all margins/padding to zero in CSS and then set each element individually to what you want.
Aug 23 '07 #9
173 Expert 100+

I think that the problem that you had was that each level of the DOM had positioning associated with it and due to the way that inheritance is applied in each level the outcome was very different in each browser.

When designing the CSS start with broad strokes and then fine tune individual elements. Also keep checking in different browsers so that if discrepancies do occur then you know exactly what is causing them. Setting all padding and margins to 0 is something that I do whenever I am using CSS as it gives more control over the page across browsers, I also tend to remove borders from images that are children of anchors as by default they get a blue border.

I have (almost) managed to recreate the page which is standard across all browsers. For comparison the size of the CSS is under 2K compared to 35K. The only difference to the HTML is that the tabbed links at the top are now:
<li class="navbut4"><span>&nbsp;</span><a class="b" href="popular-news">Popular News</a></li>
<li class="navbut3"><a class="b" href="upcoming">Upcoming News</a></li>
<li class="navbut3"><a class="b" href="node/add/storylink">Submit News</a> </li>
The classes are on the list items instead of the anchors, the span on the first tab has been moved outside of the anchor and the spans of the other tabs have been removed. The span has a space in it so that it does not collapse to nothing.

The CSS used is:
Expand|Select|Wrap|Line Numbers
  1. /*Remove all padding and margins*/
  2. *{padding:0;margin:0;}
  4. /*general styles according to element types*/
  5. a img{border:none;}
  6. li{list-style-type:none;}
  7. body{background:transparent url(http://ebizontech.vpsland.com/menu_test/spreadfirefox/images/bg_head.gif) repeat-x;font-family:verdana, sans-serif;font-size:76%;}
  9. /*general classes for repeated use*/
  10. .b{font-weight:bold;}
  11. .hide{display:none;}
  14. #wrapper{width:950px;margin:0 auto;}
  16. /* top image styles*/
  17. #site-name{font-size:2.5em;}
  18. #site-name *{color:#FFFFFF;text-decoration:none;}
  20. /*tabbed navigation styles*/
  21. .cab li{float:left;margin:0 0.5em;}
  22. .cab a{padding:0 0.5em;position:relative;top:8px;color:#666666;}
  23. .cab a:hover{color:#774525;}
  24. .navbut4{background:transparent url(http://ebizontech.vpsland.com/menu_test/spreadfirefox/images/tabrightB.png) no-repeat top right;height:32px;}
  25. .navbut4 span{background:transparent url(http://ebizontech.vpsland.com/menu_test/spreadfirefox/images/tableftB.png) no-repeat;height:32px;float:left;}
  27. .navbut3{background:transparent url(http://ebizontech.vpsland.com/menu_test/spreadfirefox/images/tabrB2.png) no-repeat top right;height:32px;}
  28. .navbut3 span{background:transparent url(http://ebizontech.vpsland.com/menu_test/spreadfirefox/images/tablB2.png) no-repeat;height:32px;float:left;}
  29. .navbut3:hover{background:transparent url(http://ebizontech.vpsland.com/menu_test/spreadfirefox/images/tabrightB.png) no-repeat top right;}
  31. /*navigation styles*/
  32. #navbar{border-top:8px solid #F74594;background-color:#FFC3DE;padding:8px 0 8px 30px;clear:left;}
  33. /* Hack for IE6 position*/
  34. * html #navbar{padding-top:0;}
  36. /*add bullets back to list item*/
  37. #navbar li{list-style-type:disc;padding:0;margin:0;}
  39. /*footer styles*/
  40. #footer{border-top:1px solid #666666;text-align:center;font-size:0.8em;margin:2em 0;padding:1em 0;}
  41. #footer *{color:#666666;}
The URLs for the images are absolute at present so these could be made relative again. The main differences in style are that the tabbed navigation does not overlap the site logo and that the tabs do not change background colour when hovered on in IE6. This is because IE6 only applies :hover to anchors, this could be corrected using javascript or adding more styling but as it works correctly in IE7 I would say that it acceptable as it is.

The tabs could be made to overlap the images, but this would start the issue of positioning and inheritance being applied differently so hacks would be required to make all browsers render the same.
Aug 26 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

22 posts views Thread by Marek Mand | last post: by
3 posts views Thread by Mark | last post: by
reply views Thread by DaveC | last post: by
4 posts views Thread by =?Utf-8?B?TWljaGFlbCBIYWJlcmljaHRlcg==?= | last post: by
1 post views Thread by Emil | last post: by
8 posts views Thread by jch | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.