How to apply Padding all the way to the bottom of an element

Discussion in 'CSS' started by eamo, Oct 15, 2009.

  1. #1
    I have a pic and text around it. I can apply a padding-bottom: 40px; to align the text so it doesn't wrap below the image and stays nicely aligned to the right if the image.

    But to me, seems like a messy way of doing it i.e. guessing padding. Any cleaner way to do this?
     
    eamo, Oct 15, 2009 IP
  2. MhW

    MhW Active Member

    Messages:
    370
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    85
    #2
    Perhaps you could separate your content into columns?

    For example:

    HTML
    <div class="left-col"><img src="your-image.jpg" width="200" height="100" alt="" /></div>
    <div class="right-col">Content here</div>
    Code (markup):
    CSS
    .left-col {float: left; width: 200px; margin-right: 10px;}
    .right-col {float: right; width: 500px;}
    Code (markup):
     
    MhW, Oct 15, 2009 IP
  3. eamo

    eamo Peon

    Messages:
    225
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's so crazy, it might work! Thanks.
     
    eamo, Oct 15, 2009 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Or just float the image and set a side margin around the content that's adjacent to it.
     
    Dan Schulz, Oct 15, 2009 IP
  5. rajpk

    rajpk Well-Known Member

    Messages:
    252
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    113
    #5
    use div tag i think its right
     
    rajpk, Oct 18, 2009 IP