Set the inner container to width:auto and it will fill the available
space after setting it's margins/etc, whilst the outer container will
constrain the whole thing to whatever size you set.
e.g.
<!DOCTYPE html>
<body style="margin:0;width:100%;">
<div style="width:50%; margin:0; border-width:0; padding:0;
background:red;">
<div style="width:auto; margin: 1em; border-width: 2px; background:blue;">
...
</div>
</div>