My question is very similar to this one. I would like my table to fill its container, but it takes on whatever size it wants to.
The html tags around the table are:
<body>
<div>
<section>
<table id="my_table">
The css for div and section:
div {
width: 50%;
margin: 0px auto;
overflow: hidden;
padding: 0 0;
}
section {
float: left;
margin-bottom: 20px;
}
I am not doing anything fancy with dataTables:
$('#my_table').dataTable()
I tried pretty much everything in the linked post, but I cannot get the dataTables to fill their container. I removed autoWidth and set the 4 columns to be 25% each. This changed their relative sizes but the total width was still too small.
Could this have anything to do with the section tag?
When I enter anything in the search field, the table becomes the appropriate size.
A jsFiddle that replicates the problem for me: http://jsfiddle.net/mushroom/GHU4f/1/