سؤال

I have really problem adjusting the top and the left in IE6, in all the remaining browsers things are working good.

I have this css:

font-family: "Lucida Grande","Lucida Sans Unicode",Verdana,Arial,Helvetica,sans-serif;
font-size: 12px;
height: 590px;
left: 50px;
line-height: normal;
overflow: hidden;
position: relative;
text-align: left;
top: -42px;
width: 760px;
z-index: 0;

EDIT

This top and left I get it from javascript like that:

     function()
       {H(a,{left:0,top:0});g=a.getBoundingClientRect();H(a,{left:"50px",top:"-42px"})}

I don't have css file to put codes, so if I change top and hight its not triggered in IE6. Its like I am not doing nothing.

I wonder if IE6 don't handle top and left? How can I fix this ?

هل كانت مفيدة؟

المحلول

Usually, for IE6 to render rather correctly, all blocks on page should have hasLayout enabled. I usually (somewhen about up to 2 years ago) achieved that by using height: 1px either in personal IE6 stylesheet or with "star" hack:

/* hasLayout is now on in IE6 for elements having `example` class. */
* HTML .example {height: 1px; }

But IE6 does not deserve any efforts currently (I don't support it at all as of 2011 and recommend everyone to do the same).

نصائح أخرى

Try adding position:absolute instead of relative. IE6 handles positioning usually very well. Not sure if you're using absolutely positioned children inside of this div though.

Edit.

If you're using conditionals. e.g.

<!--[if IE 6]>      <html class="ie6"> <![endif]-->

You can target the absolute positioning only in ie6.

.ie6 .your-selector {
    position:absolute;
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top