10

I got two divs

  <div>abc</div>
  <div>def</div>

with css as this

div{
  display:inline-block;
  padding:0px;
  margin:0px;
}

body{
   padding:0px;
   margin:0px;
}

how can i remove the gap/space between first and second div

link for the same http://cssdeck.com/labs/i5oysgmt

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
user1590595
  • 795
  • 2
  • 13
  • 37

3 Answers3

15

Remove the spacing at the code level.

Write like this.

<div>abc</div><div>def</div>
Kheema Pandey
  • 9,977
  • 4
  • 25
  • 26
5
div{
  display:inline-block;
  padding:0px;
  margin-left:-4px;
}
Lex Nguyen
  • 401
  • 11
  • 23
  • 2
    If you are using this dirty trick than make sure you use `-4px`, and I would like to warn you that this is a really dirty solution which will break if the font size varies – Mr. Alien Aug 05 '14 at 07:05
2

Demo

That is because of the white space in inline-block elements

html

<div>abc</div><div>def</div>

You can read here more

4dgaurav
  • 11,360
  • 4
  • 32
  • 59