- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 21 Dec 2009 20:30:02 -0600
- To: Alexis Deveria <adeveria@gmail.com>
- Cc: www-style list <www-style@w3.org>
On Mon, Dec 21, 2009 at 12:12 PM, Alexis Deveria <adeveria@gmail.com> wrote: > On Fri, Dec 18, 2009 at 6:18 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote: >> Well, I find myself once again ripping out a <dl> and replacing it >> with a <ul> with headers in the <li>s, because there's no grouping >> element around <dt>s and <dd>s. There's a perennial request for a >> <di> element, but that's not really the correct place to solve the >> problem - HTML has no need for any additional help in grouping the >> dt/dd elements, as the grouping is well-defined in the spec. This is >> purely a styling issue, and a common one for me. > > Have you considered using a table instead? I know at first glance it > may seem a bit weird, but if you style the elements to be blocks > instead of rows/cells, you may be able to get the effect you want > while maintaining proper semantics. <table> certainly provides all the structure one needs, but it doesn't feel like the semantically right element to use - I'm presenting key/value pairs, not 2-dimensional data. > I mentioned it before for my problem here [1]. Also worth noting is > the comment under mine which mentions a problem with zcorpan's > ::key-value-group. > > [1] http://forums.whatwg.org/viewtopic.php?p=496#496 Ah, yes, that is a problem. There are a number of structural pseudoclasses that one could want to apply to <dt>/<dd>s based on treating them like children of a grouping <di>, and you can't do that with ::di as I described it. There are some ways around that - we could promote pseudoelements to first-class selectors (this is desirable for other reasons as well), allowing you to write selectors like "dl ::di dd:last-child". That's definitely non-trivial, though, and to work properly would require the dd to be aware that the ::di was in the selector, so it should treat itself as a child of the pseudoelement rather than of the <dl>. I don't know if this is the right way to go. A probably better way is to use XBL2 to rewrite the <dl> into having a <di> element for styling purposes. This approach doesn't require possibly-tricky changes to the way pseudoelements and structural pseudoclasses work, because as far as CSS is concerned there now is a real element wrapping the <dt>/<dd> groups, and they are no longer children of the <dl> but rather grandchildren. I'm not sure how easy this would be, however - the algorithm grouping <dt>/<dd>s into groups is trivial but looks like it may be beyond what XBL2 can do natively. However, this could possibly be exposed as a browser-builtin binding defined by HTML5 itself. ~TJ
Received on Tuesday, 22 December 2009 02:30:34 UTC