[CSS3] ltr and rtl pseudo-class proposal

I propose to add :ltr and :rtl pseudo classes to the Selector module.

These classes reflect value of nearest element with defined @dir 
attribute in child/parent chain of the element.

So if someone will define:
<body dir=rtl>
   <ul dir=ltr>
     <li>Some text</li>

then li element here can be styled appropriately:

li:rtl { padding-left: 0; padding-right: 10px;}
li:ltr { padding-left: 10px; padding-right: 0;}

The problem is that attribute selector [dir=rtl|ltr] tests
only the element itself but not its environment (parent chain).

Selectors like these:

  *[dir="ltr"] li,
  *[dir="rtl"] li { .... }

and their variations are not quite working for the markup above.

Or is there a better (e.g. more generic) way of achieving this?

(And yes, the same thing for ttb/btt values)

Andrew Fedoniouk.


Received on Friday, 14 March 2008 03:07:46 UTC