W3C home > Mailing lists > Public > www-style@w3.org > March 2008

Proposal for clipping background images to foreground text

From: David Hyatt <hyatt@apple.com>
Date: Tue, 25 Mar 2008 05:10:17 -0500
To: www-style@w3.org
Message-id: <5ED077D6-30C4-4C13-AC21-953CD2A844EA@apple.com>

I mentioned this back on May 9, 2007.

http://lists.w3.org/Archives/Member/w3c-css-wg/2007AprJun/0197.html

The original email (for those who can't read it) was:

"Random idea I just had that may or may not be cool. You be the  
judge. :)

background-clip could take the value "text". This would cause the  
background image to draw clipped to the text glyphs inside your box.

This has nice synergy with multiple backgrounds (since you could  
specify a border-clipped background image and then an additional text-  
clipped background image).

It has nice synergy with foreground color too, since the color itself  
could be partially transparent (to reveal some of the text-clipped  
background image) or fully transparent."

This is now implemented in the latest nightly builds of WebKit.  You  
can read more about it here.

http://webkit.org/blog/164/background-clip-text/

Assuming people like the idea, the part that needs hammering out is  
what exactly you are clipping to.  Right now I still clip to the  
border even when the value of text is specified (so you can't draw the  
background into text that spills outside of the border box).  I also  
don't descend into e.g., positioned children.  Decorations like  
underline/overline and shadows are included in the clip region.

dave
(hyatt@apple.com)
Received on Tuesday, 25 March 2008 10:11:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:02 GMT