Having some trouble getting two divs to float next to each other?

Use this CSS #content { float: left; width:480px; margin-right:20px; } #sidebar { float: left; width:260px; } Both elements should float left and the first one will have a margin right.

Excellent it worked. Can you explain why both elements should float left? And what is going on in your code that my code wasn't doing.

Again thanks for the answer. – Andy Sep 18 at 20:08 because if you float left both, they will be next to each other, like side by side with the correct width (not greater than the size of the parent div). If you have float right and float left you can have the result you want but I think it's easier with my solution – Book Of Zeus Sep 18 at 20:12 Ok cool, thanks for your help.

– Andy Sep 18 at 20:14 1 You are very welcome – Book Of Zeus Sep 18 at 20:15.

The problem lies in your use of margin on #content. With a margin of 260px, the outer width of #content becomes 760px, which is the entire available inner width of the parent #container. In the page flow, you see your #sidebar below your #content because there simply isn't enough room for the two elements to exist side by side.

Drop margin-right from #content and things should display as you want them. Keep in mind that this configuration is very tight and will break again when you introduce any CSS properties that alter the outer width of either #content or #sidebar (this includes border, padding, and margin. Reading about the CSS box model will help you better understand what is going on.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions