Putting block div into css

You used inline block and that is automatically placed on the baseline just like text to allow room underneath for descenders. That also means you will get extra horizontal space between blocks just like the space between words.

You should have floated the elements and avoided all these issues and all your verbose code as shown in my very first example which is still the correct answer to this layout.

4 Likes