Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove space between two div element [duplicate]

Tags:

html

css

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

like image 525
user1590595 Avatar asked Aug 05 '14 06:08

user1590595


People also ask

Why is there a space between two divs?

Due to that floating , a white space has occurred between those two divs (between the div for header and div for main body). My question is, why this kind of problem is raising due to floating.? make sure your margin are all equal to 0 , so are the padding of your elements.

How can I remove space between two div tags in bootstrap?

You can add new class to your div elements and remove padding/margin with css. To make it more clear, bootstrap assigns margin-left: -15px and margin-right: -15px for . row selector and padding-left: 15px and padding-right: 15px on all . col-* selectors to get 30px space between all the cols.


2 Answers

Remove the spacing at the code level.

Write like this.

<div>abc</div><div>def</div>
like image 101
Kheema Pandey Avatar answered Oct 19 '22 14:10

Kheema Pandey


div{
  display:inline-block;
  padding:0px;
  margin-left:-4px;
}
like image 21
Lex Nguyen Avatar answered Oct 19 '22 15:10

Lex Nguyen