Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline-Block without margins?

Tags:

css

I have several DIV's displayed as inline-blocks; and they seem to be getting spacing automatically applied in between them from the browser. They have margin/padding set to 0. Is there a way to correct this without using negative margins?

like image 524
Sam Avatar asked Jul 12 '12 20:07

Sam


People also ask

Can inline block have margin?

Inline-block elements are similar to inline elements, except they can have padding and margins added on all four sides.

Do inline elements have margins?

The margin-inline CSS shorthand property is a shorthand property that defines both the logical inline start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation.

Can inline elements have padding?

padding-inline is a CSS logical shorthand property that combines the padding-inline-start and padding-inline-end properties into a single declaration, creating space around an element's content in the inline (left and right) direction.


1 Answers

You can use both display: inline-block and float: left to remove that space.

Here goes plunkr: https://plnkr.co/edit/Sn3NG77asiXO8UrrpxWD?p=preview

like image 116
Santosh Avatar answered Oct 11 '22 00:10

Santosh