CSS, Background Images, and Rollovers
It occurred to me that this ought to be possible by reassigning a container's background-image property when it is :hover-ed.
Source: Images and thumbnails, a pure CSS hack (via dbagg: Items by Time)
Yup, and you can do the same for every other pseudo-class of an anchor tag. I read about this via Eric Meyer’s article on the O‘Reilly Network. I’m still very much a CSS neophyte, but it’s helped me incredibly at work, where I was able to create a site layout with one set of HTML pages styled by a small library of CSS files for look & feel.
<p>Yeah, yeah, that’s what it’s for, you say. But it surprised the hell out of me that I was able to abuse background image properties of containers to create JavaScript-free rollovers, as well as select between completely different image-based layout elements. This isn’t pure utopian <span class="caps">CSS</span> that I’m doing, and most of my position is still with tables, but thanks to blank pixel images atop <span class="caps">CSS</span>-controlled background images, I can do what I think are amazing things.</p>
<p>Now I just have to break free of the rest of my <span class="caps">HTML</span> crutches, circa 1996.</p>
shortname=css_rollovers
Archived Comments