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

Divs not floating side by side, but going underneath

  • www.ziggiebless.com/test.html. Please note the photos and other divs on the right should be next to the bio not below.
    www.ziggiebless.com/revisedstyles2.css.

    Thanks in advance for your help.
    Raquel
  • You need to float the blocks on the right side not push them over with left margin. Set them to float: right and they'll kick up where you want them. Until you float the elements they want to take up the full width of their parent container.
  • oh ok, i'm going to try that, i am absolutely driving myself crazy. It seems i'll spend a day figuring out something. It will work and then the next day i'm doing the same thing all over again :(. I'll let you know how it turns out, thx again!
  • have you tried changing the display property from block to inline-block? I'm sure you know but block level elements don't allow any other elements to be beside it. Good luck.
  • Hi Matt,

    I totally messed that up. I am new to CSS, have been teaching myself since April. Whenever I think i got it, i screw something else up. I took a break. I am now working on a new page, not using margin left like i did in the past. I am trying to have two columns, bigger videos float left (width 600 x 400) smaller videos float right (300 x 300). I need the smaller videos to stay to the right and immediately start underneath each other instead of starting at the 400 height of the floated left items. What do i need to do?

    www.ziggiebless.com/videostest.html
    www.ziggiebless.com/videostest2.html

    The difference is first one, i had video div and left div next to each other. Second one i have all video divs first and then left divs. Please help!!! Thanks.

    my style sheet rules for this page
    }
    .live{
    float:right;
    width:300px;
    height:300px;
    padding:10px;
    }
    .video{
    float:left;
    width:600px;
    height:400px;
    padding-top:10px;
    padding-left:15px;
    }
    #video-wrapper{
    width:960px;
    padding-top:10px;
    }
    stylesheet in www.ziggiebless.com/revisedstyles2.css (it's a mess from all my attempts at working on this site. I will fix once i'm done with fixing pages)


    I might post this to the group as well since I'm not sure how often you are on and how soon you can get back to me.
  • The problem is the way you are inserting each individual div.

    Have a div for wide/tall videos and a second for thin/narrow videos and put only those videos in each div.

    I'll try an work something up later in codepen to give you the general idea.
  • Thanks Paulie. I thought that is what I did. I have a video wrapper div and I just created a live wrapper div, the same thing is happening :(

    www.ziggiebless.com/videostest4.html

    }
    #live-wrapper{
    width:300px;
    padding-top:10px;
    }
  • thank you Paulie I can't way to see it work!!! I will let you know :)
  • Thank you Paulie, you are a Godsend!!! The only thing is in dreamweaver design view i can only see the first row, but i can work in code. My dreamweaver cs5 has been acting very screwy and I have been forced to work in code view alot more recently. Thanks again for your help. Hopefully i don't screw anything up once i add the videos. I'll keep you posted :)

    http://www.ziggiebless.com/videostest4.html
  • It looks like you may have not floated the video-wide or video-live divs but good luck with it.
  • Hello Paulie,

    I have started putting in some of the videos and only the first one is showing. What did I do wrong?

    http://www.ziggiebless.com/videostest.html
  • Also I just copied and pasted your code in. I didn't realize i had to float those divs :/
  • Looks like you're getting there.
  • You're giving the video divs all the same ID. You can't do that.
  • k let me check.
  • it appears to be working, i just have to add the rest of the videos and play around with the padding a little bit later. I thank you SO much for your help!!!

    www.ziggiebless.com/videostest4.html
  • Hello Paulie D,

    Thanks for your help before. I am now trying to put to use what you told me for the rest of the pages on my website. I'm working with php includes. Can you please tell me why my divs are not floating? Thanks!!!

    www.ziggiebless.com/php.php
    css
    www.ziggiebless.com/php.css
  • I know very little about PHP but you should be applying the floats to the divs called "600-wide" and "300-wide" NOT the divs with a class of 'video' AND I'm not seeing any widths being applied to those divs.
  • Also, you can't use numbers to start IDs or classnames so you'll have to change those.

    Here's an updated example. http://codepen.io/anon/pen/tbhqm
  • Hey Paulie. Thanks again for your help! I first tried using your codepen, but decided it might be quicker to first try and rename those numbered divs. It worked!!!
    http://www.ziggiebless.com/php.php.
    Thanks again, I wasted an entire day on what was a simple change to make :/
  • Excellent. Good luck.
  • Thank you :-)