Re: Non-Background images with Hover ?

> On Jan 9, 2015, at 2:29 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> 
> On Fri, Jan 9, 2015 at 1:53 PM, Crest Christopher
> <crestchristopher@gmail.com> wrote:
>> Tab Atkins Jr. said:
>>> Crest Christopher said:
>>>> Hi, can you use non-background images with pseudo-element:hover ?
>>> 
>>> I don't understand what you're asking. Can you give an example?
>> 
>> I want to use an <img> tag with :hover in conjunction with a sprite ?
> 
> No, you can't change what an <img> element displays with CSS.

If it is absolutely positioned, you could use 'clip: rect(t, r, b, l)' to show only certain portions of the image. We don't yet have a 'crop: x, y, w, h' property, but we should. 

Otherwise, if you have a wrapper element, you can set the width, height, and 'overflow:hidden' on that, and use negative margins or relative positioning to move the image around within the wrapper's "window" of what is shown. 

Received on Friday, 9 January 2015 22:44:53 UTC