If you have markup like this:
one
two
Well, there are spaces between them!
For a fix, try using font-size: 0
in the parent element.
This is The solution.
<style>
* {
border:0;
margin:0;
padding:0;
box-shadow:0 0 1px 0px silver;
}
.foo {
width: 100%;
}
.bar {
width: 50%;
float:left;
text-align: center;
}
</style>
<div class="foo">
<div class="bar">
...a new customer
<!-- the whitespace between the following divs affects rendering - why? -->
</div> <div class="bar">
...an existing customer
</div>
</div>
There's a better way of removing the white space than setting font size to zero (as that method has unpleasant side effects). You can word-spacing instead:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
section {
word-spacing:-.25em; /* hide whitespace nodes in all modern browsers (not for webkit)*/
display:table;/* Webkit Fix */
}
div {
width: 100px;
height: 40px;
background: #e7e7e7;
padding: 10px;
display:inline-block;
word-spacing:0; /* reset from parent*/
}
</style>
</head>
<body>
<section>
<div>one</div>
<div>two</div>
<div>three</div>
</section>
</body>
</html>
This is exactly what they should do.
Spaces between inline elements are no different from spaces between words.
If you don't want that, use block elements, or set the font size to zero.