W3C home > Mailing lists > Public > www-style@w3.org > June 2010

Re: [css3-text-layout] margin-before/after/start/end etc. and :ttb pseudo-classes

From: Håkon Wium Lie <howcome@opera.com>
Date: Sun, 6 Jun 2010 16:10:03 +0200
Message-ID: <19467.44091.233529.919227@gargle.gargle.HOWL>
To: "MURATA Makoto (FAMILY Given)" <eb2m-mrt@asahi-net.or.jp>
Cc: www-style@w3.org
Also sprach MURATA Makoto:

 > >  > We are stuck.
 > >  > 
 > >  > Pseudo-selectors based on values specified in documents or stylesheets 
 > >  > do not allow reasonable fallbacks from vertical writing to horizontal writing.
 > > 
 > > I don't understand how you reached this conclusion. Could you
 > > illustrate with an example?
 > Because no matter what is specified within documents or stylesheets, 
 > browsers or usres might choose horizontal writing direction, and 
 > will then interpret every property.

Let me try to rephrase the problem to see if I have understood. An
author writes some content that is intended for vertical layout. Then
the user chooses to view the content in horizontal mode, or perhaps
the UA only handles horizontal mode. You're saying that, in cases like
these, it's not possible to set reasonable fallback values using
the pseudo-selector scheme.

Assuming I have understood the problem, let's see if it can be solved. 

Let's use these definitions for the pseudo-selectors:

  :lrt   horizontal writing is supported and @dir has been set to 'lrt'
  :rtl   horizontal writing is supported and @dir has been set to 'rtl'
  :ttb   vertial writing is supported and the initial value of
         'writing-mode' is 'tb-rl'

Further, let's assumue that the initial value of 'writing-mode' is
'tb-rl' when the UA is started. If so, this style sheet could describe
a presentation for primarily vertical content, but with horizontal

  /* preferred styling for vertical content */

  body:ttb {
    writing-mode: tb-rl;
    margin: ...;
    padding: ...;
    font: ...;

  body:ttb table {
    writing-mode: lr-tb;
    margin: ...;
    padding: ...;
    font: ...;
Now, perhaps the user turns the tablet or give some other hint that a
horizontal presentation is preferred. Then the initial value of
'writing-mode' is set to 'lr-tb' and the :ttb selectors do not match
anymore. So, the declarations above would not apply. Instead, these
declarations could apply:

   /* fallback values for horizontal presentation */

  body {
    writing-mode: lr-tb;
    margin: ...; 
    padding: ...;
    font: ...;

  body table {
    writing-mode: lr-tb;
    margin: ...;
    padding: ...;
    font: ...;

These declarations would also be used by UAs that do not know the :ttb

The normal cascading rules of CSS will ensure that the declarations
meant for vertical presentation are used in vertical mode, and that
the fallback values are used in horizontal mode. You can also change
fonts etc. when the mode change from vertical to horizontal. 

So, it seems that it is possible to encode reasonable fallback values
using pseudo-selectors, no?

              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome
Received on Sunday, 6 June 2010 14:10:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:36 UTC