Re: background-position and bidi in CSS 2.1

Daniel Glazman wrote:
> 
> Currently implementing background-* properties in BlueGriffon,
> I have found two issues in the case of a rtl document:
> 
> 1. we miss the values 'start' and 'end' for horizontal position
>    and that's is incredibly painful for rtl documents.

To overcome these problems (in my PinkPterodactyl) I was forced
to add right/bottom positioning attributes as:

background-position-left,
background-position-top,
background-position-right - initial value auto
background-position-bottom - initial value auto

So for RTL environments you can define following:

option
{
   background-position: 3px 50%;
}

option:rtl
{
   background-position-right: 3px;
   background-position-left:auto;
}

And yet having four background-positions together with, say,
background-repeat:stretch; allows to define effects that are not
achievable with background-size/origin.


> 
> 2. a length always aligns the top left corner of the image.The
>    definition for <length> values should probably be bidified
>    and use "top right" corner in case of rtl. If it's not the
>    case, it forces web authors to make computations that are not
>    existing in the case of ltr.

I've tried. That created significantly more problems than solutions.
Anyway in most cases you even cannot reuse the same image for rtl
case - it needs to be changed.

In my opinion for RTL support in CSS significantly more valuable
would be an introduction of :rtl pseudo-class. It is "on" when
nearest container of the element with dir attribute has value of the
dir attribute equal to "rtl".

Without this it is simply impossible to define default styles of 
elements like ul/li, etc. Neither one UA does mirroring of
margin-left and margin-right attributes.

I really don't know how people are dealing with such lack of RTL
support in CSS now.

Say, how you would define styling of following <select>
http://www.terrainformatica.com/w3/tree-view.png
that will render properly in <form dir="rtl">?
It is simply not possible in CSS ...


>    I have a good example : make an arbitrary background image non
>    tiling aligned with the top start corner of the content edge
>    of a box having a left padding of 10px and a right padding of 7px.
>    Trivial for ltr, painful for rtl. Preserving the behaviour if
>    the width of the box changes will require JS in rtl documents.

Yeah, that requires that background-position-right.
But please without those magnificent start and end things as
in some writing systems start is top.

 >
 > </Daniel>
 >
 >

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Sunday, 14 December 2008 07:15:37 UTC