In one of my table cells, I have the following structure:
<td>
<div class="table-wrapper">
<table class="inner-table">
<!--content-->
</table>
<div>
</td>
I added the div so I could create a border around the table with a 10px gap. However, when it displays, the div takes up the entire width of the enclosing td. What I actually want is for the div to be only as wide as the table it wraps (plus margin). I'm struggling to achieve this using CSS, although it should be simple. I managed to make it work with JavaScript, but I would prefer a CSS solution. Setting width:auto
for the div didn't help.