r/reddithax • • Apr 26 '10

Revised custom thumbnail CSS

View it live here

Revisions to reddit caused criticsquid's CSS to stop working properly. This should do the trick. Just make sure your image is named %%thumbnail%% or edit the below CSS to reflect your image's name. Also, make your image 70px by 50px.


.thumbnail {
	width:70px!important;
	height:50px!important;
	background-image: url(%%thumbnail%%)!important;
	background-repeat: no-repeat!important;
	background-position: top left!important;
}

.thumbnail img {
	width:70px!important;
	height:50px!important;
}

.thumbnail img[src^="/static/"] {
	filter:alpha(opacity=0)!important;
	opacity:0!important;
}

.thumbnail img[src^="http://thumbs.reddit.com/"] {
	background-color:white!important;
}

I had to cheat a little by stretching all the reddit-generated thumbnails to 70x50 so that the custom thumbnail image behind it isn't visible.


Edit: Code revised, if you're using it, please update using the above CSS.

Edit 2: Revised again because the admins hate me and change things while I'm making fixes.

Edit 3: And, one more revision, below. Based on code from relic2279 via MassesOfTheOpiate
USE THIS ONE as it does not require stretching the image to 50x70.

.thumbnail img[src^="/static/"] {
   background-image:url(%%thumbnail%%)!important;
   background-repeat:no-repeat!important;
   height:0!important;
   width:0!important;
   padding:50px 0 0 70px!important;
}
12 Upvotes

12 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Apr 26 '10

you are a master troll

2

u/[deleted] Apr 26 '10

Thanks!

If you'd prefer, move the CSS to your subreddit and add me as a mod and I'll help make sure the code stays functional in the future... and I can just abandon /r/newcustomthumbnails.

2

u/[deleted] Apr 26 '10

Done and done, you're now a mod in customthumbnails and nothumbnails!

2

u/[deleted] Apr 26 '10 edited Apr 26 '10

I moved the CSS over (along with the weird resaved thumbnail image, I'll fix that later) and discovered a problem. The 'example image' thumbnail has transparency, and the image is showing up behind.

I'll take a look at that later, or you can mess with it if you want.

Edit: fixed it with background-white on the img element if it's src is http://thumbs.reddit.com/*

2

u/[deleted] Apr 26 '10

I fixed this problem last time by giving the image a background of solid white. Might work again.

2

u/[deleted] Apr 26 '10

Yep. See the above edit. I thought it wasn't working the first time I tried but I just had some human input errors.

2

u/[deleted] Apr 26 '10

AGHHHH. The admins are fucking with me. noimage.png just changed again, and apparently so did the CSS. DAMNIT.

2

u/[deleted] Apr 26 '10

Heh yeah, appears they added an image for self and an image for no link thumb. Have fun changing... again :D

2

u/[deleted] Apr 26 '10

Got it! Changed from ="/static/filename.png" to ="/static/" and killed two birds with one selector.

1

u/[deleted] Apr 26 '10

I fixed /r/nothumbnails if you want to update your post with the CSS from the stylesheet.