I'm using w3css with class w3-table. I set the width for each "td" with width 35px and height 35px. I found out that the width still changes according to the text.
Here is my code:
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3.css">
<style>
.box{
width: 35px;
height: 35px;
border: 1px solid black;
}
.yellow {
background-color: yellow !important;
}
</style>
<body>
<table class="w3-table">
<tbody>
<tr>
<td class="box yellow">20</td>
<td class="box yellow">1000</td>
<td class="box yellow">2</td>
<td class="box yellow">10</td>
<td class="box yellow">1000</td>
</tr>
<tr>
<td class="box yellow"> </td>
<td class="box yellow"> </td>
<td class="box yellow"> </td>
<td class="box yellow"> </td>
<td class="box yellow"> </td>
</tr>
</tbody>
</table>
</body>
</html>
Whereby I attach the result output as below:
There have A, B, C, D, E column labelled for easy me to explain. A with text 20 B with text 1000 C with text 2 D with text 10 E with text 1000
A and D column have two digit text ie 20 and 10 respectively. I expected A and D have the same width but the output result showed A width slightly bigger than D. I can conclude that the first column always slight bigger compare to other columns. I also notice that the column width change according to the number of text. Example 1000 in column B and E width bigger 2 in column C.
May I know how to make sure the column width able to maintain a fixed size ratio in each column while being able to maintain a responsive web page?
I appreciate if you can give me some hints on this.