I am trying to create a tabular structure with CSS, having relative widths.
CSS:
.dtable { display: table; width:100%; }
.drow { display: table-row; width:100%; }
.dcell { display: table-cell; }
#control_panel { width:100%; }
#left_nav { width:14%; padding: 1%; }
#chart_container { width:84%; padding:1%; }
HTML:
<div id='main_wrapper' class='dtable'>
<div id='control_panel_wrapper' class='drow'>
<div id='control_panel' class='dcell'>
</div>
</div>
<div id='bottom_wrapper' class='drow'>
<div id='left_nav' class='dcell'> </div>
<div id='chart_container' class='dcell'> </div>
</div>
</div>
Javascript Code before closing body tag:
<script>
$(document).ready(function() {
console.log($(window).width());
console.log($("#bottom_wrapper").width());
console.log($("#left_nav").width());
console.log($("#chart_container").width());
});
</script>
Output:
1356
1340
1282.2
3.2
Why is left_nav not getting 14% width of its parent, bottom_wrapper?