A html table cols and rows are generated dynamically,
i.e, for the first instance it could be two rows and there columns. and next time it could be two rows and 10 columns
My question is how to adjust the with automatically of the table so that the table always appears 100% in the page adjusting the coulmn size and row size
<table>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
</table>
<table>
<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
</table>
Thanks..
To set the table width in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <table> tag, with the CSS property width.
HTML tables can have different sizes for each column, row or the entire table. Use the style attribute with the width or height properties to specify the size of a table, row or column.
Using CSS:
<style type="text/css">
table { width: 100%; }
</style>
<table>
...
</table>
or using a CSS inline style:
<table style="width: 100%">
...
</table>
or using old school HTML:
<table width="100%">
...
</table>
Put
width="100%"
In your table tag -- it will always be 100% width. Is that what you meant?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With