There is a weird gap appearing between the elements here. I would prefer to have them flush together. Any idea how to fix this?
Random gap between elements or divs
5.6k views Asked by Brandon At
7
There are 7 answers
0
On
It is a margin/padding issue as stated by others. What I suggest if you are just getting started and haven't developed any habits yet is to always include a reset.css file. This will get rid of all the browser defaults and allow you to start fresh.
0
On
It's a good idea to use a CSS reset file, like the one you can find on YUI: http://developer.yahoo.com/yui/reset/
If you do end up using the YUI CSS Reset, make sure you set your background color on the HTML tag as well since YUI's CSS Reset turns it white.
html {
background:black;
}
body {
margin: 0px;
font-family: helvetica;
background: black;
}
It's because you haven't styled those elements which leave it up to the browser to decide. Chrome for instance decide to input margins on the p-element.
Use a css reset file and you will both fix this particular problem but problably many many similair situations in your future as a web developer.