Since you are new to CSS, why not learn a modern layout technique with a broad range of options (flexbox), as opposed to an older method which has limited capacity and was never intended for building layouts (floats)?
With CSS3 Flexible Boxes (flexbox) you can build your layout quickly, simply and efficiently.
Here's all you need:
HTML (removed inline styles)
<div class="header">
<div>Buttons</div>
<div>
<a data-code="button" title="Show Source" class="top-button">
<i class="fa fa-code"></i>
</a>
</div>
</div>
CSS (added two lines of code)
.box .header {
font-weight:300;
border-bottom: 1px solid #ccc;
font-size: 15px;
margin-bottom: 10px;
padding: 5px 10px;
line-height: normal;
/* new */
display: flex;
justify-content: space-between;
}
DEMO
Flexbox benefits:
- minimal code; very efficient
- centering, both vertically and horizontally, is simple and easy
- equal height columns are simple and easy
- multiple options for aligning flex items
- it's responsive
- it's the future of CSS layouts
Note that flexbox is supported by all major browsers, except IE 8 & 9. Some recent browser versions, such as Safari 8 and IE10, require vendor prefixes. For a quick way to add all the prefixes you need, post your CSS in the left panel here: Autoprefixer.