- From: Håkon Wium Lie <howcome@opera.com>
- Date: Fri, 28 May 2010 16:26:35 +0200
- To: Sylvain Galineau <sylvaing@microsoft.com>
- Cc: "www-style@w3.org" <www-style@w3.org>
Also sprach Sylvain Galineau:
> According to CSS2.1 : "If there are two values, the top and bottom margins
> are set to the first value and the right and left margins are set to the second."
>
> So you're effectively saying that margin: 20px 10px would result in the application
> of logical margins based on the writing-mode and/or :lang() but if the author writes:
>
> p:lang(ja) {
> writing-mode: tb-rl;
> margin-top:20px;
> margin-bottom:20px;
> margin-left: 10px;
> margin-right: 10px;
> }
>
> ...which per CSS2.1 is equivalent, then the margin values would be set physically instead ?
There are only physical values in my examples. This code:
p { margin: 10px 20px }
p:lang(ja) {
writing-mode: tb-rl;
margin: 20px 10px;
}
illustrates how you can achieve automatic switching of values (as in,
"I'd like 10px margins before and after, and 20px margins at the start
and end") without introducing new properties/values.
So, I'm saying that the problem has a solution today.
Now, as it has been pointed out, the problem with this approach is
that a UA that doesn't support 'writing-mode: tb-rl' will still put
the margins in their physical location. Often, this will be what the
author intended, but sometimes not. One possible solution for this
could be:
@supports tb-rl {
p {
writing-mode: tb-rl;
margin: 20px 10px;
}
}
The @supports is a new construct. We should be careful when
introducing new constructs. But I'd much rather have this new
construct than 30 new properties. Here's a similar proposal:
http://chriseppstein.github.com/blog/2009/10/19/css-unsupported-directive/
-h&kon
Håkon Wium Lie CTO °þe®ª
howcome@opera.com http://people.opera.com/howcome
Received on Friday, 28 May 2010 14:27:25 UTC