W3C home > Mailing lists > Public > www-style@w3.org > January 2015

Re: Non-Background images with Hover ?

From: Brad Kemper <brad.kemper@gmail.com>
Date: Fri, 9 Jan 2015 14:44:24 -0800
Cc: Crest Christopher <crestchristopher@gmail.com>, "www-style@w3.org" <www-style@w3.org>
Message-Id: <6EB1205D-0C1C-4D1A-A902-809341FE7A87@gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>

> 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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:50 UTC