Somes part of display not normal under IE 7

Some parts in the page display abnormal under IE 7 but OK under firefox. how to corrcet it? and what’s the reason for those abnormal displays under IE .

the test page. test test

1, http://www.sitepoint.com/forums/attachment.php?attachmentid=56724&stc=1&d=1310294900

the abnormal display locates at the bottom of the page on the right part.

2,http://www.sitepoint.com/forums/attachment.php?attachmentid=56725&stc=1&d=1310294908

the abnormal display locates at the left part of the page.

3,http://www.sitepoint.com/forums/attachment.php?attachmentid=56726&stc=1&d=1310294918

the left part (eg:example one box) sticks middle part together,but I have setted the margin to the left part. it not work under IE7. why?

the middle part’s margin-right is larger than I setted it to which betweens the right part (eg: the middle and test two box )

I think much of your issue just stems from needlessly overcomplicated and wasteful HTML – but I say that to just about every post here on Sitepoint. CSS is only as good as the markup it’s applied to, and your markup has easily twice as many div and five times as many classes assigned in it as necessary.

Though it’s hard to say what the proper markup would be with the page missing much of it’s content… like I’m assuming you’d have a h1 or h2 somewhere before those h3? Makes no sense for those to be H3 otherwise.

But even some simple things like:


<div id="nav" class="clear">
  <div class="nav-top">
  <ul>
  <li class="navahead current"><a href="/">test</a></li>
  <li class="navahead"><a href="#">stest</a></li>
  <li class="navahead"><a href="#">hello</a></li>

  </ul>
  </div>
  <div class="nav-inner clear">
  <div class="nav-innerleft"></div>
   <ul class="navlist">
   <li><a  class="navbutton" href="#"><span>ASP</span></a></li>
   <li><a class="navbutton" href="#"><span>PHP</span></a></li>
   <li><a class="navbutton" href="#"><span>ASP.net</span></a></li>
   <li><a class="navbutton" href="#"><span>JSP</span></a></li>
   <li><a class="navbutton" href="#"><span>ROR</span></a></li>
   <li><a class="navbutton" href="#"><span>Python&#28304;&#30721;</span></a></li>
   <li><a class="navbutton" href="#"><span>JavaScript&#28304;&#30721;</span></a></li>
   <li><a class="navbutton" href="#"><span>CGI/Perl&#28304;&#30721;</span></a></li>
   <li><a class="navbutton" href="#"><span>&#20854;&#20182;&#28304;&#30721;</span></a></li>
   <li><a class="navbutton" href="#"><span>&#25554;&#20214;/&#27169;&#22359;</span></a></li>
   <li><a class="navbutton" href="#"><span>&#31449;&#38271;&#24037;&#20855;</span></a></li>
   <li><a class="navbutton" href="#"><span>&#27169;&#26495;&#32032;&#26448;</span></a></li>
   <li><a class="navbutton" href="#"><span>&#20070;&#31821;&#25945;&#31243;</span></a></li>
   </ul> 
   <div class="nav-innerright"></div> 
  </div>

You aren’t doing ANYTHING there which warrants the presence of DIV – AT ALL. Like… nothing… and all those “navbutton” and “navhead” – wasted pointless code… if they all get the same class, they don’t need a class, use the PARENT as the hook.


  <ul class="tabMenu">
		<li class="current"><a href="/">test</a></li>
		<li><a href="#">stest</a></li>
		<li><a href="#">hello</a></li>
	</ul

	<ul class="navlist">
		<li><a href="#"><span>ASP</span></a></li>
  	<li><a href="#"><span>PHP</span></a></li>
		<li><a href="#"><span>ASP.net</span></a></li>
		<li><a href="#"><span>JSP</span></a></li>
		<li><a href="#"><span>ROR</span></a></li>
		<li><a href="#"><span>Python??</span></a></li>
		<li><a href="#"><span>JavaScript??</span></a></li>
		<li><a href="#"><span>CGI/Perl??</span></a></li>
		<li><a href="#"><span>????</span></a></li>
		<li><a href="#"><span>??/??</span></a></li>
		<li><a href="#"><span>????</span></a></li>
		<li><a href="#"><span>????</span></a></li>
		<li><a href="#"><span>????</span></a></li>
	</ul> 

… and I’m not even sure I’d need the spans anymore. With all those endless “div for nothing” I’m not even sure where to start trying to figure out where/how IE7 is messing up.

Though if those out-of-place elements are absolute positioned, throw a haslayout trigger (zoom:1 good as always) on their parent. That MAY fix it.

I didn’t get time to look deeply at the misplaced divs but its most likely as Jason said the lack of haslayout in those endless nested divs that don’t really need to be there.

If you have a div wrapper that holds complicated content then the chances are that it will need haslayout in ie6 (and quite often ie7). It’s just another reason why it is important that you don’t just add unneceesary mark up. Adding zoom: 1.0 is the easiest way to trigger haslayout but don’t overuse it either.

A quick fix may be just to add a right margin to the left column instead.


#left{margin:0 10px 0 0;}

However a re-write of that section would be advised along the lines of what Jason was saying above :slight_smile:

The misplaced element in your footer is that in IE floats must always come first before the content that needs to wrap and your end corner would need to be at the beginning of the line.


    <div class="clear"></div>
    <div class="letterindex">
        <div class="index-before"></div>
        [B]<div class="index-after"></div>[/B]
        <a href="#">A</a> <a href="#">A</a> <a href="#">A</a> <a href="#">A</a> <a href="#">A</a><span></span> </div>
</div>
</body>
</html>

However I would have put your anchors in a list and used the ul for the right background corner image and the parent div for the left corner image instead of those two floats.

i added this #left{margin:0 10px 0 0;} , it’s ok when under IE6,7. FF.but abnormal when under IE8

I didn’t see that you had added the code above anyway so the IE8 problem must be an original flaw in the design.

I think you need to re-think what you are doing as it doesn’t look like a viable layout. If you want three columns then they need to be 3 columns and not individual elements here and there. The columns would also need to be the same width all the way down.

You can’t really have overlaps like you have without creating a rigid and inflexible layout. What happens if the boxes are longer or shorter than shown? They won’t fit in that context unless you are always going to keep the same height.

Just create 3 columns at the appropriate width and then stack the content inside without floating. This will be much more robust and usable than what you are attempting here.