I'd like to display 2 divs, side-by-side, equally filling available width. The problem is that when I set each to 50%, they end up stacking vertically. Setting one of them to 49% fixes it, but that feels like a kluge. Is there a better way to do this?
#red {
display:inline-block;
background-color:red;
width:50%;
}
#green {
display:inline-block;
background-color:green;
width:50%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="panel panel-default sc-panel">
<div class="panel-heading">My Panel</div>
<div class="panel-body" style="padding:0">
<div id="red">red</div>
<div id="green">green</div>
</div>
</div
-- EDIT --
yes, it's a duplicate question. Just my opinion, but I didn't like previous answers: (1) setting font-size to zero, (2) putting the html code on same line, potentially making it less readable