[html] html table span entire width?

<table border="1" width="100%" ID="Table2">
<tr>
  <td>100</td>
</tr>
</table>

This code still leaves and "inch" of space on both sides of the table. Trying to get the table to span the entire width of the page. Thanks.

This question is related to html html-table

The answer is


Just FYI:

html should be table & width:100%. span should be margin: auto;


<table border="1"; width=100%>

works for me.


you need to set the margin of the body to 0 for the table to stretch the full width. alternatively you can set the margin of the table to a negative number as well.


Just in case you're using bootstrap 4, you can add px-0 (set left/right padding to 0) and mx-0 (set left/right margin to 0) CSS class to body tag, like below:

<body class="px-0; mx-0">
    <!--your body HTML-->
</body>

There might be a margin style that your table is inheriting. Try setting the margin of the table to 0:

<table border="1" width="100%" ID="Table2" style="margin: 0px;">
<tr>
  <td>100</td>
</tr>
</table>