卓's profile成都,又是成都PhotosBlogListsMore ![]() | Help |
|
|
April 05 表格乃万恶之源也Table实在太难处理了,举个例子
<table>
<tr> <td colspan=3>A</td><td colspan=3>A</td> </tr>
<tr> <td> B </td></tr>
</table>
怎么计算每一列的宽度?
IE, FIREFOX, OPERA相比,FIREFOX在这方面的处理比较好,其他两种浏览器不同程度的存在瑕疵。 July 19 Layout strategies in mozilla (table)Notes about the layout strategy in mozillaBernd MielkeSpecsThe table layout algorithm is based on two W3C recommendations: HTML 4.01(Chapter11) and CSS2.1 (Chapter 17). In CSS2 a distinction between fixed and auto layout of tables has been introduced. The auto-layout mechanism is implemented inBasicTableLayoutStrategy.cpp the fixed-layout in FixedTableLayoutStrategy.cpp. All these files are in the layout/html/table/src subdirectory.
The codeThe layout strategies are invoked fromnsTableFrame::Reflow.
The overload of the
The wordsThe table layout is width oriented and knows the following widths:
#define WIDTH_NOT_SET -1 #define NUM_WIDTHS 10 #define NUM_MAJOR_WIDTHS 3 // MIN, DES, FIX #define MIN_CON 0 // minimum width required of the content + padding #define DES_CON 1 // desired width of the content + padding #define FIX 2 // fixed width either from the content or cell, col, etc. + padding #define MIN_ADJ 3 // minimum width + padding due to col spans #define DES_ADJ 4 // desired width + padding due to col spans #define FIX_ADJ 5 // fixed width + padding due to col spans #define PCT 6 // percent width of cell or col #define PCT_ADJ 7 // percent width of cell or col from percent colspan #define MIN_PRO 8 // desired width due to proportional <col>s or cols attribute #define FINAL 9 // width after the table has been balanced, considering all of the others The priority of allocations for columns is as follows:
Column width infoColumns get theire width information from style info<col width="200px"> and from the cells that belong into this column. These informations are very often conflicting. For instance one cell could have a large min width,the next could have a specified fixed width and another a specified pct width. For a given width type the maximum wins.
Special caseswidth = "0*"Assume that you would like to give all the space to the second column in a table. Poor mans choice is leave the first cell auto and specify 100%on the second one ( this works cross-browser)
0Proportional
Effective columns
numEffCols is that we dont poke the cellmap for nonexisting cells.
Overspeficied Percent Columns
<col width="33%"><col> Lets return to the first case but now but wiht more than 100%:
<col width="40%"><col>. IE and Opera handle this pretty much the same as mozilla.
The componets of Firefox layout engineJune 29 一个浏览器的feature,作为参考Fusion Web Pilot Embedded Micro Browser Features:
|
|||||||||||||||||||||||||||||||||||||||||||||
|
|