I have set up my HTML structure in the following way:
<div id="wrapper">
<div id="main">
<p>test</p>
</div>
<div id="sidebar">
<p>test</p>
</div>
</div>
Here is the accompanying CSS styles:
#wrapper {
width: 960px;
margin: 0 auto;
}
#main {
width: 790px;
display: inline-block;
padding: 0;
margin: 0;
}
#sidebar {
width: 170px;
display: inline-block;
vertical-align: top;
padding: 0;
margin: 0;
}
You can view an example at this link: http://jsfiddle.net/Hpwff/
The issue I am facing is that even though the total width of both divs adds up to 960px, which is equal to the width of the parent container (#wrapper), they do not align side by side. I find myself having to reduce the width of either the sidebar or main container by 4px for them to fit together seamlessly. Can anyone explain why this happens and suggest a workaround?