W3C home > Mailing lists > Public > www-style@w3.org > March 2008

Re: [CSS3] ltr and rtl pseudo-class proposal

From: Ben Cotterell <ben.cotterell@antplc.com>
Date: Sat, 15 Mar 2008 18:31:53 +0000
To: Andrew Fedoniouk <news@terrainformatica.com>
Cc: www-style@w3.org
Message-ID: <e4968a074ce823e79b543b9cfeb7df801ad3b9ae@localhost>

On Thu, Mar 13, 2008 at 08:07:03PM -0700, Andrew Fedoniouk wrote:
> 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>
>   </ul>
> </body>
> then li element here can be styled appropriately:
> li:rtl { padding-left: 0; padding-right: 10px;}
> li:ltr { padding-left: 10px; padding-right: 0;}

That's basically how we did it in ANT Galio, although we put the margin
on the ul, as per CSS 2.1 Appendix D.

    ul { margin-left: 40px }
    ul:rtl { margin-right: 40px } 

since you really do need to move the margin to the right for rtl or
nested lists won't indent and bullets will be off the screen.

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

Another way of doing this kind of thing is to have more properties
called margin-start, margin-end, etc., where start means "left if ltr,
right if rtl".

Not sure which is better.
Received on Saturday, 15 March 2008 18:32:30 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:34 UTC