Re: CSS3-box: margin-outside and the cascade

On Tue, 20 Aug 2002, fantasai wrote:
> 
> ua.css -
> 
>   ul {
>     margin-start: 2em;
>   }
> 
> author.css -
> 
>   ul {
>     margin-left: 4em;
>   }
> 
> list.html -
> 
>   <title>A List</title>
>   <link type="text/css" rel="stylesheet" href="author.css">
>   <ul>
>      <li>apples
>      <li>milk
>      <li>bread
>      <li>peanut butter
>   </ul>
> 
> 
> Reasonable case, no? The author is going to be a bit surprised at the
> result, though.

During the CSSWG meeting last week, David Baron came up with an ingenious
scheme to solve this. However, the point is pretty moot since, for now, it
has been decided to drop the BASE (before/after/start/end) properties to
avoid property glut. (To convert CSS2.1 to BASE would require the addition
of 34 new properties and 26 new keywords, and CSS3 makes this even worse.)

The theory goes that in practice, stylesheets written for ltr documents
don't Just Work for rtl documents as well.

FWIW, David's proposal was:

   margin-left: 2em sets
      margin-left-value to 2em
      margin-tb-lr-left-source to left
      margin-tb-rl-left-source to left
      margin-bt-lr-left-source to left
      margin-bt-rl-left-source to left
      margin-lr-tb-left-source to left
      margin-rl-tb-left-source to left
      margin-lr-bt-left-source to left
      margin-rl-bt-left-source to left

   margin-start: 4em sets
      margin-start-value to 4em
      margin-tb-lr-left-source to start
      margin-tb-rl-right-source to start
      margin-bt-lr-left-source to start
      margin-bt-rl-right-source to start
      margin-lr-tb-top-source to start
      margin-rl-tb-top-source to start
      margin-lr-bt-bottom-source to start
      margin-rl-bt-bottom-source to start

Then to determine what margin value to use for the left side, you look
at the relevant *-source property, which would be decided based on the
'writing-mode' property (a shorthand which also sets 'direction'). For
example, in top-to-bottom left-to-right text like English, you look at
the 'margin-tb-lr-left-source' property, and find it is set to 'start'
(since the 'margin-start' rule overrode the 'margin-left' rule) and so
you use 'margin-start-value'. In right-to-left bottom-to-top text, you
would look at 'margin-rl-tb-left-source', and find that that is set to
'left' so you use 'margin-left-value'.

It's a remarkably neat scheme.

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Saturday, 31 August 2002 15:41:29 UTC