SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: floating divs

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Edinburgh, Scotland
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    floating divs

    I've got a div (id="container") that contains a number of divs (class="content"). I've also got an Amazon div (id="amazon") that I want to position top right of the container div.

    If I set the "amazon" div to float:right, then all is ok (as long as it is placed at the top of the page. However, I then have to have clear:both or clear:right as part of the "content" div in order to prevent the text overwriting. If I add the clear option, then the div begins below the amazon div.

    What do I need to do to get the contents div to fit in the space to the left of the amazon div?

    Is it also possible to have the amazon div HTML lower down the page, but still get it appearing at the top right?

    PS All of this might be easier to understand at http://www.johnrudge.f2s.com/, and then selecting the "test" style from the righthand side.

    Thanks for any help

  2. #2
    SitePoint Zealot HardinComp's Avatar
    Join Date
    May 2003
    Location
    Boston, MA
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If the top section is the same size on all of your pages you can set up your Amazon div with absolute positioning. That way you can put the code anywhere on the page and it will show up in the same physical location.
    J.M. Hardin
    My blog
    Registered Ubuntu User #10980

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Edinburgh, Scotland
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Jeanne, but what I'm really after is the space to the left of the Amazon div being available for my "content" div.

  4. #4
    SitePoint Zealot HardinComp's Avatar
    Join Date
    May 2003
    Location
    Boston, MA
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So you want it to be fluid. In that case I believe you should keep it where it is. Sorry about my misread
    J.M. Hardin
    My blog
    Registered Ubuntu User #10980

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Edinburgh, Scotland
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem! Thanks for the suggestion anyway.


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
  •