Vijay Kumar B Vijay Kumar B - 11 months ago 93
CSS Question

How to remove gap between two inline-block elements?

I'm aligning two block elements side by side using

property. But when I use this property, it shows some gap between two elements. Why?

HTML code

<div class="parent">
<div class="child"></div>
<div class="child"></div>

css code


Answer Source

There are multiple methods to do that. I will explain two of those.

  1. Place the two .child elements sideby side in HTML with no gap. This should remove the space in output.

  2. Make the font-size:0px; to the .parent element. This will removes the space.