SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cant create padding top :-(

    Bounjourno from Wetherby UK

    Ok on this page http://www.innoviafilms.com/NatureFlex.aspx & illustrated here http://i216.photobucket.com/albums/c...-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.

    Grazie Tanto,
    David
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,777
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Hi,

    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.

  3. #3
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Legend Thank you :-)
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •