
About the disappearing "margin-top" known issue on IE6 & IE7
Hello,
I have suffered that issue for a long time, and I just found out in your "known issues" page that this is caused by PIE forcing "zoom:1" to trigger hasLayout to true on IE < 8.
I couldn't find any subject about that issue on this forum, and wanted to discuss this: I have 3 questions to which I answered with my opinion, but would like to know yours please...
1) What would have happened if you didn't apply that "zoom:1;" property? would that prevent PIE from working? Would that break PIE's border-radius, box-shadow or linear-gradient?
=> I wanted to try that by myself by removing "zoom=1;" from PIE.js 0.5, and that doesn't change anything to the problem: top margins still disappear. Do you know why?
2) What would you suggest to people having problems with that?
=> For now, my solution is to replace every margin-top on elements with an equal padding-top on the elements' container. That works in most cases but that's annoying to do on a huge website that existed before PIE.
3) Do you have any ideas or projects about that issue in the future versions of PIE?
=> What about automatizing what I do in my 2nd question during PIE.attach(element)? Would that be possible for you, just on IE6 and 7, to "read" the desired margin-top, and adding it to the actual padding-top of the element's container? Or create an empty transparent div before the element which would have a height equal to the desired margin-top, and thus, would push the element downwards? Or maybe a wrapper instead of an "element before". (or even another way of which I didn't think?)
Here are HTML snippets of these ideas, that work for me:
Adding a div with the right height before:
Code:
<body>
<div>
<!--[if lt IE 8]><div style="width: 1px; height:100px;"></div><![endif]-->
<div style="border-radius: 10px; margin-top: 100px; background: yellow; width: 100px; height: 100px; behavior:url(PIE.htc); ">
ok!
</div>
</div>
</body>
Change the container's padding-top:
Code:
<body>
<div style"*padding-top:100px;">
<div style="border-radius: 10px; margin-top: 100px; background: yellow; width: 100px; height: 100px; behavior:url(PIE.htc); ">
ok!
</div>
</div>
</body>
Add a wrapper with the right padding-top
Code:
<body>
<div>
<!--[if lt IE 8]><div style="padding-top: 100px"><![endif]-->
<div style="border-radius: 10px; margin-top: 100px; background: yellow; width: 100px; height: 100px; behavior:url(PIE.htc); ">
ok!
</div>
<!--[if lt IE 8]></div><![endif]-->
</div>
</body>
(of course all that can be done in pure JS, these gross HTML versions are just to illustrate my ideas)
Thanks for your thoughts!