Re: [css3-gcpm] applicability of 'string-set' within display:none

Peter Moulder wrote:

 > The css3-gcpm spec is quite explicit that 'string-set' still applies
 > even for elements with 'display:none' (and presumably all descendants of
 > display:none elements).

Yes. This example is shown:

  h1 { 
    display: none;
    string-set: header content();
  }

The motivation for allowing this is to encourage content to be placed
in the document rather than the style sheet. For example, to set a
running header, it's better to use:

  <title>foo</title>
  
  title { string-set: title content() }
  @page :right { @top-right { content: string(title) }}

than to say

  @page :right { @top-right { content: "foo" }}

because the style sheet is more reusable this way.

I believe the <title> element was the main argument for defining it
this way -- it should be possible to pick up the content of the title
element even if 

  head { display: none } 

is set (as the default style sheet for HTML4 does).

 > Authors who want to set a named string while hiding the corresponding
 > element can hide the heading in other ways than using display:none
 > (and the hidden heading can be made out of flow if margins are an issue).

How would you code the <title> use case?

-h&kon
              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome

Received on Thursday, 20 October 2011 23:01:59 UTC