treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Float problems

  • Hi,

    Once again I have a problem with css.

    It's about this website: http://tinyurl.com/6e6elof
    As you can probably see, the right half, aka the sidebar, should be in 3 pieces, top, and under that a left and a right column.
    And on the left just the main blog.

    I made the color differences with a background image.

    But when the right block with the video's becomes longer than the main blog on the left, it pushes the sidebar content to the left.

    How do I make shure the side bar items will stay on the right side?

  • You could position right sidebar absolute, add margin: 0 0 0 500px; push other content on right down also.
    Dont know if this is the best solution tho.

    Or you could expand wrapper to more than 1000px.
  • That does not do the trick.. :(
    Any other solutions?
    I have made an example post, there is a link in it. click it to see what happens when the post is not long enough..

  • Hmmm, I can't actually see a problem on the link.
  • Look on the site, there is a post called 'Sidebar example' on the top of the page.
    Click the link in that post and look where the sidebar content goes..

    The sidebar content that's underneath the post 'video item 2'
  • The two bottom pieces (leftsidebar and rightsidebar) aren't being contained in the overall sidebar.

    Move everything into the rightbar:

    <div id="rightbar">

    <div id="topsidebar">
    <div class="storycontent"></div>
    <div class="feedback"></div>
    </div><!-- close topsidebar -->

    <div id="leftsidebar"></div>

    <div id="rightsidebar"></div>

    </div><!-- close rightbar -->
  • Yes!
    It's solved! :D

    Thanks very much!