W3C home > Mailing lists > Public > www-style@w3.org > October 2011

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

From: Håkon Wium Lie <howcome@opera.com>
Date: Fri, 21 Oct 2011 01:01:02 +0200
Message-ID: <20128.43054.542750.892078@gargle.gargle.HOWL>
To: Peter Moulder <peter.moulder@monash.edu>
Cc: www-style@w3.org
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:45 GMT