I ran this code on Linux in Firefox and everything work fine! So it the problem in the browser not in the HTML code.
Solution 1 :
Problem :
I want to make a table using <colspan>
and <colgroup>
, but I don’t get the need result.
<table border="2px">
<colgroup>
<col width="20%">
<col width="20%">
<col width="20%">
<col width="20%">
<col width="20%">
</colgroup>
<tr>
<td colspan="3">60</td>
<td colspan="2">40</td>
</tr>
<tr>
<td colspan="1">20</td>
<td colspan="4">80</td>
</tr>
</table>
My result: https://www.w3schools.com/code/tryit.asp?filename=GGD2TG4Q6EQL
Comments
Comment posted by MDEV
Very odd, but seems to be because you never use the full width – adding in a header row of all 5 cells makes it behave properly. not sure if this is expected behaviour though. Update: does what you expect in Firefox – seems to be a Chrome issue
Comment posted by Archer
I noticed that if add all 5 column everything works fine. But why?
Comment posted by MDEV
Not a clue I’m afraid – potentially a browser bug. Perhaps have a Google, see if anything comes up about this. Otherwise report a Chrome bug perhaps