The space between elements is displayed. Imagine <strong>Hello</strong> <em>world</em>
. This is displayed as "Hello world". See the space between Hello and World.
An enter and multiple spaces are collapsed to a single space.
<strong>Hello</strong>
<em>world</em>
becomes "Hello world".
The same is happening with your divs. They are both 50% of the screen, but the space also takes up 10 pixels, pushing the 2nd div to the next line.
There are several ways of solving this. Using float
, using display: table-cell
or (as I usually prefer) by eliminating the space between the divs using XML comments <!-- -->
.
<div id="content">
<div id="action">
<div id="buy" class="action">Buy</div><!--
--><div id="sell" class="action">Sell</div>
</div>
<div id="other">test</div>
</div>