Re: [css3-background] should radii be capped?

On Tue, Jul 21, 2009 at 4:46 PM, Håkon Wium Lie<howcome@opera.com> wrote:
> Also sprach fantasai:
>
>  > > Opera, however, doesn't cap the radii but attempts to honor them. I
>  > > can see many uses for the elliptic expressions that this behavior
>  > > allows. The spec, instead, will leave us with many stadium-like
>  > > borders, as can be seen in the two leftmost Firefox renditions.
>  >
>  > If you want an elliptic look, then set the two corner radii to two
>  > different values.
>
> That's possible when you know the width and height of the box. But, if
> either the widths or height is unknown, it is impossible to get the
> elliptic shape in a static style sheet. For instance, this gives you
> an elliptic border:
>
>  width: 100px; height: 200px;
>  border: 1px solid red;
>  border-radius: 50px / 100px;
>
> However, when the size of the box changes the elliptic shape is gone.

Is the use case of "make elliptical boxes easy to specify" stronger
than "keep corners the same shape", though?

Your proposed change makes it impossible to guarantee that corners
look the same everywhere, while with the current spec text elliptical
corners can be maintained if you can at least control the *ratio* of
the box's width/height.  There are ways to do that.

> (It's probably possible to reinstantiate the elliptic shape through JS
> magic, be we should try to avoid that for common effects)

$(".i-have-corners").resize(function(){
  var hr = $(this).width()/2, vr = $(this).height()/2;
  $(this).css({"border-radius": hr + "px " + hr + "px " + hr + "px " +
hr + "px / " + vr + "px " + vr + "px " + vr + "px " + vr + "px"});
});

(This'll run any time the document window is resized, not when the
element is resized, but that's likely to be the most common case for
it anyway.)

>  > The goal of the formula is to preserve the shape
>  > of the curve
>
> The question becomes: if preserving the shape of the curve worth the
> higher cost of achieving elliptic forms?
>
> If we remove the protection of the shape, what's the worst case
> scenario?

That I intend to have a standard rounded box, but end up with a
strange elliptical shape under certain conditions.  Spec behavior
makes it decay into either a lozenge or a circle, both of which are
closer to my intent than an ellipse.

~TJ

Received on Tuesday, 21 July 2009 22:12:08 UTC