I have create a table using <td>
with 5 columns. i have set table width as 100%. When i set the <td>
width of the table as 100% and above the horizontal scrollbar does not work.
I have raised a related question already. since i did not get any answer for that question. I am again raising it here. Hope some one can help me solve this.
I have seen lot of questions regarding the size of Horizontal property given in pixels but could not see anything on %. Any help is greatly appreciated.
I want to create something like that is shown in the picture. enter image description here I have used Pixels to create it. But i need to give in %.
Previous Question Pasted by me: link: Html table - td width in percentage with overflow not working
Html:
table {
width: 100%;
border-collapse: collapse;
}
td {
border: 1px solid black;
}
<table>
<tr>
<td style="width: 25%">Column 1</td>
<td style="width: 25%">Column 2</td>
<td style="width: 25%">Column 3</td>
<td style="width: 25%">Column 4</td>
<td style="width: 25%">Column 5</td>
</tr>
</table>
I have used Pixels to create it. But i need to give in %. HTML Table Pixels and %:
table {
width: 100%;
border-collapse: collapse;
}
td {
border: 1px solid black;
}
<div class="tableDiv" style="width: 100%; overflow-x: auto; ">
<table >
<tr>
<td style="min-width:250px;">Column 1</td>
<td style="min-width:250px;">Column 2</td>
<td style="min-width:250px;">Column 3</td>
<td style="min-width:250px;">Column 4</td>
<td style="min-width:250px;">Column 5</td>
</tr>
</table>
</div>
<br/>
<div style="width: 100%; overflow-x: auto;">
<table>
<tr>
<td style="min-width:25%;">Column 1</td>
<td style="min-width:25%;">Column 2</td>
<td style="min-width:25%;">Column 3</td>
<td style="min-width:25%;">Column 4</td>
<td style="min-width:25%;">Column 5</td>
</tr>
</table>
</div>