Search code examples
csshtmlrandomgaps-in-visuals

Random gap between elements or divs


There is a weird gap appearing between the elements here. I would prefer to have them flush together. Any idea how to fix this?

LINK


Solution

  • 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.

    p { ...
    -webkit-margin-before: 1em;
    -webkit-margin-after: 1em;
    ... }
    

    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.