Bounjourno from Wetherby UK
Ok on this page http://www.innoviafilms.com/NatureFlex.aspx & illustrated here http://i216.photobucket.com/albums/cc53/zymurgy_bucket/top-padding-css-no-gocopy.jpg Ive been trying to add a text line but i need to create some whitespace between the top of the text and the image block. Ive tried to ad padding-top:10px; but nothing. What confuses me is that i can add padding in any other of the 4 directions but not top:-(
Please could someone explane why i cant add padding top to the p tag.
The element above is floated so you would need to clear the text (clear:both) otherwise the padding slides under the float above. When you clear a float the elements top margin is increased (browsers may differ in how this is accomplished) so that it pushes it beyond the float. If you don't clear the element then the padding slides under the float towards the top of the containing block as though the float wasn't there.
That's why you can't use a top margin on a cleared element either because the top margin refers to the top of the containing block and ignores any floats in the way. You would need to add a margin greater than the height of the float above which would usually be unknown so you can't really do that. To make room under floats its always best to put a bottom margin on the float itself.
Legend Thank you
This topic is now closed. New replies are no longer allowed.