Re: position: pointer

On Fri, Oct 12, 2012 at 1:20 PM, Lea Verou <> wrote:
> I agree the use case needs to be addressed, but I'm not sure about the
> position proposal. This only addresses a very limited number of use cases.
> For instance, suppose we have a radial gradient and we want its center to
> follow the mouse pointer [1]. Or, a shadow that moves its offsets as the
> mouse moves, to look more natural [2]. Or the infamous parallax effect. We
> still won't be able to do things like that.
> I think the most flexible solution would be a new unit (e.g. mx for
> horizontal and my for vertical) that describes the offsets of the mouse from
> the viewport. Akin to vw and vh, 100mx would represent the horizontal offset
> of the mouse from the left edge of the viewport and my the vertical offset
> from the top. Not sure if scrolling should affect this or not.
> That way, position: pointer would be:
> position: absolute; /* or fixed */
> left: 100mx;
> top: 100my;
> Thoughts?

That's a very interesting idea!  However, it seems of limited
usefulness.  The mouse pointer is a position, not a size; you would
very rarely want to use a fraction/multiple of the position for

What might be a better approach is to add to the <position> type
something that allows this - for example, a "position()" function that
takes an argument detailing what you want the position of (right now,
only one value: pointer).  You could then directly use this in things
like radial-gradient().  We'd then also amend the grammar for
top/left/etc to take position() and use the x/y portion of that
position, as appropriate.

I think this version of the idea needs some more baking to get mature, though.


Received on Friday, 12 October 2012 21:08:13 UTC