PDA

View Full Version : Placing 2 Divs side by side


Jittor
05-21-2008, 08:10 PM
Hey all,


I am trying to place 2 divs side by side. I have one div with a margin-left:170px (I have a left hand menu that's is why the px is so high.) but when I try to put the second div with a higher margin-left: px to be placed next to the first div the second div just gets places right below it. I tried to float:right the second div but it still just ends up right under the first div.

Any ideas, is there a better way to do this?

domedia
05-21-2008, 09:21 PM
Just float both Div's to the same side, no margins needed. If you don't float a div, it's always going to start on a new line; it's a block element.
Floated elements always have to be put ahead of the elements in needs to be floated against. That's why your first try with float didn't work.

Jittor
05-21-2008, 09:27 PM
Figures, the one thing I didn't try. I floated 1 but not both. Thanks Dom, I was going crazy. I knew it was something simple but just couldn't seem to get it to work. :) Thanks!

domedia
05-21-2008, 09:53 PM
Come back for more, there's plenty of tricks in this bag ;)

Death Dream
05-21-2008, 10:18 PM
Ahhh darn I wanted to show off what I learned too! I knew this one! =D

~Death Dream~

Jittor
05-26-2008, 03:15 AM
Your funny DD :)

I can ask it again if you would like :)

Death Dream
05-27-2008, 03:09 PM
Your funny DD :)

I can ask it again if you would like :)

HAHAHA! I'll have to take a raincheck on that one.

~Death Dream~

2bz2p
05-27-2008, 05:49 PM
Yall are the best,

I was going to ask a question why IE was messed up and FF worked, now that I floated both columns with out the margins it works in both.

Just floated both columns one to the left and one to the right.

Thank you
2b