- From: Christoph Päper via GitHub <sysbot+gh@w3.org>
- Date: Thu, 28 Jul 2016 08:16:56 +0000
- To: public-css-archive@w3.org
Crissov has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-content][selectors] :level(an+b) Pseudo Class == The [generation of bookmark levels](https://drafts.csswg.org/css-content/#bookmark-generation) has been discussed e.g. in #204 and [in November 2015 on www-style](https://lists.w3.org/Archives/Public/www-style/2015Nov/0310.html). @frivoal had shown that it’s nearly impossible to recreate the HTML5 outline algorithm with existing Selectors, so `bookmark-level: auto` would make some sense. That value hasn’t been added to the drafts, though, and I would like to propose a different solution, a new pseudo-class. Nesting, stacking or hierarchy levels are of interest for styling in several cases, e.g. headings or sections and lists in document markup languages or layers and sprites in images. So let there be an abstract **level** that depends on the host language and may differ among its element types. Since a pseudo class increases specify, the followin rulesets should describe the usually desired behavior for HTML: :level(0) { bookmark-level: none; } h1, h2:level(1), h3:level(1), h4:level(1), h5:level(1), h6:level(1) { bookmark-level: 1; } h2, h1:level(2), h3:level(2), h4:level(2), h5:level(2), h6:level(2) { bookmark-level: 2; } h3, h1:level(3), h2:level(3), h4:level(3), h5:level(3), h6:level(3) { bookmark-level: 3; } h4, h1:level(4), h2:level(4), h3:level(4), h5:level(4), h6:level(4) { bookmark-level: 4; } h5, h1:level(5), h2:level(5), h3:level(5), h4:level(5), h6:level(5) { bookmark-level: 5; } h6, h1:level(6), h2:level(6), h3:level(6), h4:level(6), h5:level(6) { bookmark-level: 6; } The syntax inside parentheses would probably follow the existing `an+b` syntax, but I‘m not sure we’d need to differentiate `:first-level`, `:last-level` and `:nth-level()`, but it would be consistent. Likewise, one could easily ensure the same marker style for items in nested lists, no matter if the structure mixes `ol`, `ul` and `dl`. ul>li:level(2) { list-style-type: disc; } Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/351 using your GitHub account
Received on Thursday, 28 July 2016 08:17:13 UTC