I was wondering how modern browsers render html tables, for example how they figure out the exact size of the cells. After googling a bit, all I found was an RFC from 1996, but nothing new. Since I also read that html 5 specifies the parsing algorithm, so I thought maybe the algorithm for determinating the layout is also specified or at least it is described how a possible algorithm should work. Just looking at the code of open source browsers would probably be very time consuming and therefore rather not an option.
Creating Tables in HTMLYou can create a table using the <table> element. Inside the <table> element, you can use the <tr> elements to create rows, and to create columns inside a row you can use the <td> elements. You can also define a cell as a header for a group of table cells using the <th> element.
To manipulate the height or width of an entire table, place the size attribute (either "WIDTH=" or "HEIGHT=") within the <TABLE> code. To manipulate individual cells, place the size attribute within the code for that cell.
Not specific to HTML, but the paper The Table Layout Problem (Richard J. Anderson, Sumeet Sobti) analyzes laying out a table, e.g. minimum height for fixed width and other problems.
It concludes that the problem is NP-complete and suggests a number of heuristics.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With