I just did a flickr bar for a client who requested it and it turned out cool, so I thought I’d add a similar one to my own site, and for the heck of it, I also thought I could share how I did it. First, scroll down and take a looksie…

I removed the flickr bar from my site (was a little too much for me), but you can still find it on Ben’s site.

Cool, huh? So I started with two images… a plain square with a border and a duplicate with a shadow. To get the border box, I create a plain square in photoshop and double-click the layer to get the styles box. There I select inner glow.

  1. choose a color
  2. set blend mode to normal
  3. set range to 0
  4. set opacity to 100%
  5. then just set the size to a size you like

You can also use STROKE for this, but I used glow because I sometimes want a softer line

Now, I duplicated that layer and went to styles again to put an outer shadow on it. I leave them positioned directly on top of one another and then crop right within a pixel of the edges of the shadow box. I hide the shadow box while I save a JPG of the main box. I then come back to the image and hide the main box (flickr.jpg) while I save a JPG of the shadow box (flickr_h.jpg).

The “Flickr” title on top of the boxes is a little trickier. I went ahead and positioned it in Photoshop just how I wanted it to look. I then cropped it to fit the title with a portion of the box (you don’t have to, but I did so I could see where to position it later with the CSS).

That’s it for the images, now for the code! Here’s the base HTML:

<div id="flickr"> <h2><span>Flickr</span></h2> Insert Flickr script from your flickr badge </div>

The “span” is to hide the text and replace it with your image. You COULD just insert the image here, but it doesn’t work as nicely unless you do it purely with CSS. And, if someone is reading your site with a screen reader or another machine without CSS, they’ll see the span text instead of the image.

It has been pointed (yes, I missed it), there is another way to do the header. Instead of the span, just give the header (h2) a text-indent of something outrageous like -5000px to hide. That makes it a little easier on those for whom the span would be hidden completely in another medium.

Okay, the good stuff now, the CSS…

#flickr {
width:118px;
margin:30px 20px;
text-align:center;
}
#flickr h2 {
background: transparent url(images/flickr_h2.jpg) no-repeat top left;
height: 50px;
width: 130px;
margin-left:-4px;
}
#flickr h2 span {display:none;}
#flickr_badge_image1 {
margin-top:-28px;
}
.flickr_badge_image a {
margin-left:13px;
width:75px;
display:block;
background: transparent url(images/flickr.jpg) no-repeat top left;
padding: 5px 16px 19px 5px;
}
.flickr_badge_image a:hover {
background: transparent url(images/flickr_h.jpg) no-repeat -1px -1px;
padding: 4px 17px 20px 4px;
}

That’s all. If I missed something or if I was unclear, let me know. Despite what my friends say, I’m not perfect. :)