r/csshelp • • Apr 07 '12

How to implement flair?

I've been wanting to use images as flair for my subreddit (similar to how r/gamemusic does) but I haven't the slightest idea on how. I've read some topics on this, but they all discuss it in a way that makes no sense to me.

Can somebody explain how to in a way that would make sense to a total idiot?

8 Upvotes

9 comments sorted by

3

u/redditMEred Apr 07 '12

First make the image sprite. Then this to the CSS:

/* FLAIR CSS */
.flairselector .customizer {
    display: none !important
    }
.flair {
    border: none !important;
    top: 20px;
    padding: 0px;
    background: url(%%flair%%);
    display: inline-block
    }
.flair {
    display: inline-block;
    padding: 0;
    background: transparent url(%%flair%%) no-repeat;
    color: black;
    border: 0;
    border-radius: 0;
    text-indent: -9999px;
    width: 32px;
    height: 32px
    }
.link .flair, .entry .tagline .flair {
    float: left
    }
.flair-flair2 {
    background-position: -??px -??px
    }
.flair-flair2 {
    background-position: -??px -??px
    }
.flair-flair3 {
    background-position: -??px -??px
    }
.flair-flair4 {
    background-position: -??px -??px
    }
.flair-flair5 {
    background-position: -??px -??px
    }

Flair "1,2,3,4" are the CSS classes so go to the flair and and add them thier(you can change the naems in the names panel but class has to stay. You choose whether users can edit thier own. You can also add more flair by adding more icons to the sprite then updateing. After updating the image add:

    .flair-flair5 {
    background-position: -??px -??px
    }

right below:

    .flair-flair4 {
    background-position: -??px -??px
    }

so that it it looks like this:

/* FLAIR CSS */
.flairselector .customizer {
    display: none !important
    }
.flair {
    border: none !important;
    top: 20px;
    padding: 0px;
    background: url(%%flair%%);
    display: inline-block
    }
.flair {
    display: inline-block;
    padding: 0;
    background: transparent url(%%flair%%) no-repeat;
    color: black;
    border: 0;
    border-radius: 0;
    text-indent: -9999px;
    width: 32px;
    height: 32px
    }
.link .flair, .entry .tagline .flair {
    float: left
    }
.flair-flair2 {
    background-position: -??px -??px
    }
.flair-flair2 {
    background-position: -??px -??px
    }
.flair-flair3 {
    background-position: -??px -??px
    }
.flair-flair4 {
    background-position: -??px -??px
    }
.flair-flair5 {
    background-position: -??px -??px
    }

you can add as much flair as you want!

1

u/[deleted] Apr 07 '12

Thank you for this very informative post :) For the sprites, do I just find a sprite sheet and cut out every individual one?

Also, what number do I put for the question marks as seen here

.flair-flair5 { background-position: -??px -??px }

2

u/redditMEred Apr 07 '12

Do you know what a sprite is?

??px -??px }

that's the position if the image on the sprite

1

u/[deleted] Apr 07 '12

I know what a sprite is, how do you find out the position of the image on the sprite?

2

u/redditMEred Apr 07 '12

MSPaint displays the cursor position relative to the image on Windows 7. If you use the select tool, it will show the size, and the position. OR you can use the ruler in photoshop

1

u/[deleted] Apr 07 '12

Another question, what do you put for background: url(%%flair%%);

in the flair part?

2

u/redditMEred Apr 07 '12

You upload the sprite and name it flair

1

u/[deleted] Apr 07 '12 edited Apr 07 '12

I actually got it to work! Thank you so much!

But the only thing is that it takes up too much space, as in it's right beside the text of the post. How could I fix this?

And if I add another flair, where do i paste that URL?

2

u/MeGustaTortugas May 10 '12

Any way to allow for both a image and text, but control them separately? Make the image show up to the left, but the text show up to the right?