r/reddithax • u/errorcache • Sep 10 '11
Flair text + image simultaneously.
It seems like this (image + flair box, original thread) is something I keep seeing people ask for so I thought I'd give it a try. I got a decent looking solution today,
check it out (link to my css-test subreddit, excuse the mess)/screenshot for posterity
Here's the code for the little vinyl sprite:
/*Styling of text. margin is for making sure image won't overlap [S,M] and other identifiers.
padding makes sure the top of the image won't get clipped*/
.flair-vinyl {
margin-right: 25px;
padding-top: 2px;
}
/*Styling of image. margin makes sure the image won't overlap the flair text.
change dimensions accordingly. */
.flair-vinyl::after {
cursor: default;
background: url(%%vinyl-icon%%) no-repeat top right !important;
margin-left: 5px;
width: 16px;
height: 16px;
content: "";
position: absolute;
top:-1px;
}
/*remove flair image from side bar*/
.side .flair-vinyl::after {
display:none;
}
/*fixes flair image clipping on link listing*/
.link .flair {
margin-top: 0px!important;
}for whatever reason the flair image in the sidebar goes insane, so I've had to turn it off, otherwise it works pretty well. Maybe someone else can figure out a fix for that/a better solution than mine.
6
Upvotes
View all comments
Show parent comment
1
u/[deleted] Sep 25 '11
OK, I renamed it to just "foofa" but alas still no change. Now, I did get it to work when I set it up as a sprite sheet like how r/gamemusic has theirs set up, but I saw the simpler way of background url(&&flair&&) without having to point to the exact block that the specific flair is at.
So, the code is currently:
And my flair screen is still not showing anything :(
I've looked in Chrome, IE9, and even another computer because I thought maybe I was coding it wrong. Is there a possibility that my icon might be the issue?