1220621-1f.html (527B)
1 <!DOCTYPE html> 2 <style> 3 table { 4 table-layout: fixed; 5 border: 1px solid black; 6 width: 300px; 7 } 8 td { 9 background: yellow; 10 border: 1px solid purple; 11 } 12 </style> 13 <table> 14 <colgroup> 15 <col> 16 <col> 17 <col> 18 <col> 19 </colgroup> 20 <tbody> 21 <td>One</td> 22 <td>Two</td> 23 <td>Three</td> 24 </tbody> 25 </table> 26 <script> 27 var t = document.querySelector("table"); 28 // Flush layout 29 var width = t.offsetWidth; 30 // Remove the one colgroup 31 document.querySelector("colgroup").remove(); 32 </script>