Blog

Fitting two divs next to each other

Here’s something for beginner CSS. Fitting two divs right next to each other, without an empty space between.

Here’s an example:

That should work, but it doesn’t. The total width does add up to 100% (I checked), yet they can’t fit next to each other. How about changing one of the margins?

It fits! But wait, there is that little annoying space in between. The solution is below. All you have to do is to comment out the white space between divs.

Also jsFiddle is absolutely awesome tool!
Hope it helps!
Cheers!