[whatwg] [Rendering] zero width attributes on table, th, td should be ignored
L. David Baron
dbaron at dbaron.org
Wed Jan 2 12:47:26 PST 2013
# The table element's width attribute maps to the dimension
# property 'width' on the table element.
# The td and th elements' width attributes map to the dimension
# property 'width' on the element.
These rules should have an extra condition to say that any zero
value (be it a zero integer or a zero percentage) is ignored rather
than mapping to the 'width' property.
This is needed for Web-compatibility; width="0" is ignored by all
major browser engines (at least for the td case, which I tested),
and source-code comments in Gecko indicate this behavior is needed
However, they're ignored at different levels in different engines.
In Gecko and IE10, they're ignored at the level that I'm proposing,
and 'width:0' in CSS still works. In WebKit and Opera, 'width:0' in
CSS is *also* ignored, presumably at the table layout level. Given
the engine split here, I believe it's better to have the weird
behavior be more limited, and I'd prefer to see the ignoring be
specified at the HTML level so that CSS behaves without this
My tests are as follows:
This pair of tests demonstrate that the HTML width="0" is
ignored in all engines, and the first cell is slightly wider
than the second.
This pair of tests demonstrate that HTML width="1" works in all
engines, and forces the first cell to its minimum intrinsic
This pair of tests shows differing behaviors between browsers;
the first cell is narrowed to its minimum intrinsic width in
Gecko and IE10 (showing the behavior is at the HTML level) but
not in WebKit or Opera (showing the behavior is at the CSS
(It might be worth writing the parallel tests for <table> since I
only tested <td>, and the parallel tests for percentage values since
I only tested integer values.)
𝄞 L. David Baron http://dbaron.org/ 𝄂
𝄢 Mozilla http://www.mozilla.org/ 𝄂
More information about the whatwg