I have an .aspx file and i try to align the table to the center. But when i do this

<table style="text-align:center">

it does not work.

It shows the table always at the left side of the page.

Recommended Answers

All 2 Replies

<table style="text-align:center">
This is to align the content/data inside the table
One way to achieve your requirement is to put your table inside a div and align the div to center. Here is a sample

<div style ="width:100%; height: 100%; text-align: center">
<table >
<thead>
<tr>
<td>Name</td>
<td>Roll NO</td>
<td>Class</td>
</tr>
</thead>


<tr>
<td>Alex</td>
<td>20901</td>
<td>10</td>
</tr>


<tr>
<td>Betty</td>
<td>20902</td>
<td>11</td>
</tr>

</table>
</div>

hi,

you can try like this

<center>
<table >
</table>
</center>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.