1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-28 01:54:15 +01:00
DataTables/examples_src/basic_init/flexible_width.xml

24 lines
870 B
XML

<?xml version="1.0" encoding="UTF-8" ?>
<dt-example table-type="html">
<css lib="datatables" />
<js lib="jquery" />
<js lib="datatables" />
<title>Flexible table width</title>
<js><![CDATA[
$(document).ready(function() {
$('#example').dataTable();
} );
]]></js>
<info><![CDATA[
Often you may want to have your table resize dynamically with the page. Typically this is done by assigning `width:100%` in your CSS, but this presents a problem for Javascript since it can be very hard to get that relative size rather than the absolute pixels. As such, if you apply the `width` attribute to the HTML table tag, it will be used as the width for the table (overruling any CSS styles).
This example shows a table with `width="100%"` and the container is also flexible width, so as the window is resized, the table will also resize dynamically.
]]></info>
</dt-example>