r/csshelp • u/kjhatch • Nov 15 '11
Default Thumbnail Image Replacement
It appears Reddit updated the old default thumbnails from /static/noimage.png (etc.) to a new combined sprite:
/static/sprite-main.oJ5XDExA73c.png
That broke the custom thumbnails I had set up for my subreddit. I've tried to simply update the CSS reference to fix it, but nothing works. I've tried path, filename, type, or even class to get at it, but all are ignored. Begins-with and ends-with selectors fail. It's like Reddit's also now generating it in a way that gets around the default CSS DOM.
Am I missing something? Does anyone know a new trick to customize the default thumbnails?
9
Upvotes
3
u/kjhatch Nov 16 '11 edited Nov 16 '11
The issue that failed with the double classes is the new sprite now applies this to the container:
to move the sprite into position. When that is combined with the:
common in the older background management code (like TedFromTheFuture's example below), a smaller image disappears from the container entirely. Removing the no-repeat helps, but depending on the size of your custom thumbnail that may not position properly (as mine didn't).
The solution is to override the sprite's position (that you don't need anyhow) like this:
That works fine for me. If you want different thumbnails for default and self, just split out the definitions. You can see it in action on my subreddit. There are still some minor cross-browser issues with it that will need to be worked out. In my case I use a border radius, and it's not applying consistently across different browsers anymore, but the replacement itself is good.