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

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