SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Scott Blanchard's Avatar
    Join Date
    Sep 2010
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can a floated child establish a full height left margin for its parent?

    I have an image of width 150 pixels, whose parent container is set to float:left. I want the adjacent text to have a margin equal to the width+margin of the floated box, only if the floated box is present.

    HTML Code:
    <div class="box">
      <figure style="float:left; margin:10px 15px 0 0" /><img src="avatar.png" /></figure>
      <div class="description">Description goes here. I need it to not wrap under the floated image, just the right of it</div>
    </div>

  2. #2
    Ripe Tomatos silver trophybronze trophy Rayzur's Avatar
    Join Date
    Jun 2007
    Location
    Texas
    Posts
    4,174
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    If you apply overflow:hidden; to your div.description it will restrict the text from wrapping under the float when the float is present.


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
  •