Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Posts
    189
    Thanks
    38
    Thanked 3 Times in 3 Posts

    float right and images

    Let's say I have a container div with overflow: auto which also has a width of 900px. Let say I have a div set to float left with width of 400px. And another div float right of 400px. The div which floats right contains an image 450px. The result is a bottom scrollbar appears because the image can no longer fit in the div floating right. Is there a way to forced the image to pull the entire div away from the right edge of container so it doesnt overflow but still leans against the right side of the container?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Can we have a link to your page? Or please provide some sample code.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,178
    Thanks
    15
    Thanked 253 Times in 253 Posts
    I think you may have over specified things a bit. Here's what I would suggest. Put both images in the container div, without being wrapped in divs themselves. The images don't 'spread out' the way that divs do. Set the width of the images to, let's say, 48%, and then float them.


  •  

    Tags for this Thread

    Posting Permissions

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