Thursday 16 June 2005
display:inline and tables
We have run into a problem. Some important Web sites have HTML like this:
The intent seems to be to create an inline table. Unfortunately
the CSS spec currently says otherwise:
Currently, in Gecko we have a bug which effectively causes the anonymous table to be treated as an inline-table, usually (but not always!). Because we don't really support inline-table, it probably doesn't work the way an inline-table should.
What should we do? There are a few possibilities:
I'm leaning towards the second option, but any feedback would be helpful.
<div>Hello <table style="display:inline">...</table> Kitty</div>
The intent seems to be to create an inline table. Unfortunately
the CSS spec currently says otherwise:
- "display:inline" turns the table element into a regular inline element, not a table at all.
- The presence of table rows and columns causes an anonymous table box to be created to wrap them. This happens to be in roughly the same place as the original table element.
- The spec is quite clear that this anonymous table box has "display:table". (It says "a box corresponding to a 'table' element will be generated between P and T", and the default style sheet is clearly "table { display: table }".)
- This is a block-level box inside an inline box, which causes complicated splitting to happen. But the important thing is that this table box will be on its own line, not inline.
Currently, in Gecko we have a bug which effectively causes the anonymous table to be treated as an inline-table, usually (but not always!). Because we don't really support inline-table, it probably doesn't work the way an inline-table should.
What should we do? There are a few possibilities:
- Fix our code so that the anonymous table is a block-level table, according to spec. Then get everyone who relies on our behaviour to fix their sites --- soon, before Firefox 1.1 is released. One big problem here is that because we don't support inline-table or inline-block, there may be no way to work around the removal of this feature/bug.
- Get the spec changed so that when the parent box is an inline box, the anonymous table is made an inline-table. Then change our code to support inline-table as best we can before release.
- Leave the spec as is, but implement inline-table so people can get the old behaviour.
I'm leaning towards the second option, but any feedback would be helpful.
Comments
Option 1 without option 3 is not an option.
Fixing bug 18217 seems like a good idea anyway, but moving people to untested code seems like a bad idea to me, when the tree is already frozen. In the last time I worked on the fallout from the scrollframe landing, so I know what I am talking about.
What is the state of other browsers supporting this feature?
bernd: I agree
Anko: you misunderstood. What IE is doing is broken. And because of that, current usage and implementations are inconsistent with the spec. I'm suggesting we change the spec so that what every major browser currently does, and what Web authors expect, is correct.
http://www.w3.org/TR/2005/WD-CSS21-20050613/changes.html#q19
I'm not sure exactly what hyatt is proposing, or what Safari does.
Is this something what could be generalized in css?
When you have this for example:
<div style="display:inline;">
<div style="display:table-cell;"></div>
</div>
you also get display:inline-table; for the generated anonymous table?
ant: that requires a lot of web sites to be changed. I also think the proposed change is both simple and more intuitive for web authors and is therefore a good idea even if web authors weren't already depending on it.
With regard to solution 3, that would mean we have to change our current code:
table {
display:inline;
}
into:
table {
display: inline;
display: table-inline;
}
Where the display inline is there in order to make it still work in FF 1.0. So I guess that�s feasible.
So I am personally in favour of solution no. 2, because that makes the most sense and would cause the least trouble with existing sites, but I wouldn�t mind solution 3 either, if the standards people want that.
~Grauw
btw something seems to be wrong with the preview feature - when I selected it the Comments box didn't populate.