Firefox: fine.
IE8: fine.
IE6/7: the menu doesnât care about the margin-top applied to .webdesign so itâs stuck to the image above. Even with a 200px value, it doesnât move.
Iâve fixed the problem by applying a padding to the .maincontainer instead.
But Iâd still like to know what caused this! :mad:
Actually the code you posted renders the same in IE6/7 as the other browsers you mentioned. I suspect we are missing some of your code.
The thing to consider here is that floats are removed from the page flow. Any top margin on an element after the float will be in relation to the static content that is above the float. If there is no content above the float, then the parent container will be the marginâs starting point.
That brings up another subject, the clear property. Now, if you were to set clear:both; on your .webdesign div you would see things differently. IE6/7 would actually get it wrong at this point and apply that 20px top margin and good browsers would still let that top margin slide behind the float. The cleared div would actually be below the float in good browsers but the margin would not be visible.
It is always best to set any margin you need on the bottom of the float.
Computing the clearance of an element on which âclearâ is set is done by first determining the hypothetical position of the elementâs top border edge within its parent block. This position is determined after the top margin of the element has been collapsed with previous adjacent margins (including the top margin of the parent block).
Here is the code you posted set up as a stand alone test case. Be aware also that âhaslayoutâ was not set on the .wedesign div with your code so IE is treating it differently in that aspect also.
I commented out the clear:both and the haslayout properties. If you break them loose you will see things differently.
Hi, sorry for the code.
Iâve read your links but Iâm not sure if it applies as I donât want to clear my floats
Actually you can see the problem here : http://www.aucuneidee.net/oldindex.html
margin-top on .webdesign moves the menu but not on IE6/7