Sexy Album Overlays

It’s the social web now. We share everything, from our musical tastes, to the bacon avocado burger we ate for breakfast , to the very funny things we say and do. With amazing APIs such as the ones offered by Last.fm, Twitter, Flickr and more, we can now put them all on our sites, showing close to real-time updates of the music we are listening to, conversations we are having, and the things we are seeing.

With this slew of api stew hitting the fan, its no wonder websites and blogs are looking cramped, busy, and ugly. Why not pretty them up a bit? That’s what I intend to do. I want to show you how to style your music streams and give you some graphics to do so, cause let’s face it, it takes time to design things and it’s easier to use mine than yours ;) Alright, enough banter, let’s get to the goodies.

The XHTML

Keeping it simple and semantic, we describe our “list” of music with an unordered list. We link the title and supply a thumbnail image to bring some life to the album. In the real world, fill your alt attributes and titles with some helpful information for those using screen readers. Simple enough eh?
<ul class="music">
<li>
<a href="...">Hungry Like the Wolf: Duran Duran</a>
<img src="albums/duran.jpg" alt="..." />
</li>
</ul>

The PNG Overlays

Next, if we are talking sexy, we need sexy PNG images designed to lay over the images. This way, our list doesn’t look like the same old boring square 50px x 50px image (like everybody else and their llama’s neighbor has). This is the part where you get lucky and get some freebies thrown your way. Here are three PNG images that I’ve designed (perhaps inspired by some music apps around the intarweb) that are free for you to do whatever you’d like with. Yes, even that.

Jewel Case

Jewel Case

Vinyl Record Sleeve

Vinyl Record Sleeve

Compact Disc

Compact Disc

The CSS

Now that we have some sweet looking markup, and the PNG overlays ain’t that bad either, let’s get to rocking the stylesheet to make this all come together in a beautiful matrimony…or something like that.

Okay, the first thing I am going to do in lieu of a reset stylesheet is just reset what I am working with like so:

ul.music,
ul.music li,
ul.music li a,
ul.music li img{
margin:0;
padding:0;
list-style:none;
border:0;
text-decoration:none;
}

Next, I want a little bit of margin (or spacing) between my list of albums. This is totally up to you, but I decided to go with 15 pixels. Also, I want the albums to show up in a row and then line wrap when they reach the edge of the containing element. To do this, I float the list items left:

ul.music li{
margin:15px 15px 15px 0;
float:left;
position:relative;
}

Okay, the next rule will style the link to the album and it gets a little more hairy. I’ll explain the premise of the style and you can fill in the gaps of how it works. The idea is that we can use the link as the album overlay if we set the PNG image as the background (for this example, we are using the vinyl overlay). As long as we put the link over the image (z-index and relative positioning) and set the dimensions (block display, width and height) of the link to that of the PNG overlay, it should work.

Also, I decided for my implementation, that I didn’t want the text of the album to show, hence the negative text-indent rule and overflow:hidden; to keep that negative text indent from showing. You can keep the album text with a few additional styles.

ul.music li a{
display:block;
position:relative;
background:url(vinyl.png) 0 0 no-repeat;
float:left;
width:90px;
height:82px;
text-indent:-1000em;
overflow:hidden;
z-index:1;
}

If you’ve done your math, we’ve only got one more tag to style: the img tag. The idea with styling this is very simple. Just set the dimensions of the image to that of the viewport of the PNG overlay and position the top-left coordinate so that the image lines up perfectly in the viewport. We use absolute positioning so that this image doesn’t affect the size or layout of it’s parent list item and position it right in the viewport of the vinyl png image, in this case at the 2px, 1px coordinate:

ul.music li img{
position:absolute;
width:72px;
height:72px;
left:2px;
top:1px;
}

Wait, what if there isn’t album art?

That’s right. You are special. You listen to underground music. This music is so underground and obscure, that not even the most savvy of databases can capture your unique taste, leaving you with a bunch of empty albums and no art. Well, you rogue you, I’ve got some CSS to fix that. We still have one more tag we can use as a background and that is the li. I’ve whipped up some empty album art as well and we’ll use it for the blank state. All we need to do now is position the blank album insert in the “viewport” of the PNG overlay like so. Voila!

ul.music li{
background:url(blank_insert.gif) 2px 1px no-repeat;
}

That’s it!

Yeah right. There’s always the dreaded two-headed beast Internet Explorer. Let’s have a little chat about how Internet Explorer jacks things up for us web designers. First of all, IE7 really doesn’t give us that much grief. It’s biggest flaw is that it sucks big time at rendering images at any size other than its inherent size. What does this mean? Well, if an image has dimensions of 100px by 100px and you set the size (as we did) to 72px by 72px, IE7 basically takes a dump on itself and renders it with jaggies and all gross. Luckily we can fix it’s issues with the following CSS rule:

img {
-ms-interpolation-mode:bicubic;
}

Wow. That was way too easy for an Internet Explorer issue. Ahhh, don’t worry, more pain will come. Next, as we all know, Internet Explorer 6 sucks at displaying PNG images with alpha transparency. Wow. Big surprise. Luckily, there is another Microsoft-specific CSS rule that we can use to overcome this impairment. Here is the code that makes IE6 behave like a red-headed stepchild should:

ul.music li.vinyl a{
background:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='vinyl.png', sizingMethod='crop');
}

That’s it for realz?

Yes, that’s it for reals! Now you can make your Last.fm music playlists all sexy. Two words of advice. One, if you want to be mega nice, link my site as a thank you, but you don’t have to. Two, get out and make the web beautiful! Here are some resources to get you on your way:

Update

So far, I haven’t seen many sites using these overlays, but here are a few. I’d love to see how people are using it and where, so drop a line and let me know. Here are a few sites that are using these album overlays:

Comments

93 Comments

Pages:
  1. Maozad said 1203 days ago

    Thanks, Awesome

  2. Daniel Groves said 1210 days ago

    Awesome! These will be mega helpful with the redesign for my Portfolio/Blog that I am working on! Thanks!

  3. ? said 1227 days ago

    日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日

  4. Dream step » Blog Archive » ?? CSS ?????? said 1232 days ago

    [...] Sexy Music Album Overlays 为图像画廊增加更多风格样式的教程,文章使用专辑封面的制作过程作为一个实例。 [...]

  5. Gradly said 1235 days ago

    Hi
    I really like this tutorial but let me ask you a question what are you using in the footer area to pull the info from Last.fm and display it this way could once I used Last.fm fmtuner plugin for wordpress I couldnt get it to work so finally I used the cd images overlays with static images till i find a way to do it dynamically.

    thanks

  6. TechStyle by Jargal.MN » Blog Archive » CSS said 1237 days ago

    [...] 1. Зурагтай layer давхарлах [...]

  7. ?? CSS ?????? « ???? said 1238 days ago

    [...] Sexy Music Album Overlays 为图像画廊增加更多风格样式的教程,文章使用专辑封面的制作过程作为一个实例。 [...]

  8. Manny said 1240 days ago

    Wow, this is a great article thank you for sharing and caring manny [".][",]

  9. ?? CSS ?????? - ????? said 1243 days ago

    [...] Sexy Music Album Overlays 为图像画廊增加更多风格样式的教程,文章使用专辑封面的制作过程作为一个实例。 [...]

  10. 45 Powerful CSS/JavaScript-Techniques | moreInet.com | Webdesign, Graphic Design Service in Pattaya said 1245 days ago

    [...] Sexy Music Album OverlaysThis aticle shows how to style your music streams and provides you some graphics to do so. [...]

  11. 45 Powerful CSS/JavaScript-Techniques » Shai Perednik.com said 1245 days ago

    [...] Sexy Music Album OverlaysThis aticle shows how to style your music streams and provides you some graphics to do so. [...]

  12. 45 Powerful CSS/JavaScript Techniques « Extreme Design Studio Blog v4.0 said 1245 days ago

    [...] Sexy Music Album Overlays This aticle shows how to style your music streams and provides you some graphics to do so. [...]

  13. ?? CSS ?????? Mastering CSS - E@????? said 1246 days ago

    [...] JavaScript 和 CSS 技术相结合。 Sexy Music Album Overlays [...]

  14. jason said 1247 days ago

    good thinks

  15. ?? CSS ?????? - ??? said 1248 days ago

    [...] Sexy Music Album Overlays 为图像画廊增加更多风格样式的教程,文章使用专辑封面的制作过程作为一个实例。 [...]

  16. Tuguldur said 1249 days ago

    Great design concept on commonly used CSS technique.

    You could expand on this and create some retro styles like cassette tapes, vhs tapes, game cartridges etc.

  17. 5 powerful techniques using CSS and Javascript | dsxbrasil blog! said 1252 days ago

    [...] Sexy Music Album Overlays [...]

  18. 45 Powerful CSS/JavaScript-Techniques | Tutorial51 said 1252 days ago

    [...] Sexy Music Album OverlaysThis aticle shows how to style your music streams and provides you some graphics to do so. [...]

  19. Vitaly said 1252 days ago

    Here are great example of this method:
    http://www.imobilco.ru/

    I am not a author.

  20. Vitaly said 1253 days ago

    @Rogie – i have used this library http://code.google.com/p/ictinus/.

    It works. But wiki only in Russian language. From images and code i think you can get idea. For me it works well in every browser (from Chrome to IE6).

    Really sometimes you can’t use just PNG’s. But most time PNG is enough. Anyway thanks for article.

  21. 45 Powerful CSS/JavaScript-Techniques « Social-Press said 1253 days ago

    [...] Sexy Music Album Overlays This aticle shows how to style your music streams and provides you some graphics to do so. [...]

  22. Rogie said 1253 days ago

    @Vitaly, would love to see your canvas implementation!

  23. Joe Stevens said 1253 days ago

    Great technique. I am going to use it when I redesign my site. Thanks!!

  24. Vitaly said 1253 days ago

    For COMPACT DISC mode it require solid background with same color as PNG’s. Not really good. You can use canvas for make it more usable in real web-sites. I mean if background will be complicated – that’s methods don’t work well.

  25. Russell said 1253 days ago

    Looks very Sophiesticated ;)

  26. 45 Powerful CSS/JavaScript-Techniques - Smashing Magazine said 1253 days ago

    [...] ZURB Design Agency, designers who have written a series of articles on Smashing Magazine as well.Sexy Music Album OverlaysThis aticle shows how to style your music streams and provides you some graphics to do so.A Colorful [...]

  27. ??CSS?????? said 1254 days ago

    [...] Sexy Music Album Overlays 为图像画廊增加更多风格样式的教程,文章使用专辑封面的制作过程作为一个实例。 [...]

  28. ?? CSS ?????? | ?? said 1257 days ago

    [...] Sexy Music Album Overlays 为图像画廊增加更多风格样式的教程,文章使用专辑封面的制作过程作为一个实例。 [...]

  29. Sexy album overlays | FedericoVezzoli.com said 1294 days ago

    [...] myself. Last night i’ve tryed to apply this pretty nice album overlays that i found on the Komodomedia [...]

  30. Kim Jong Il said 1440 days ago

    Rogie,

    You never cease to amaze North Korea. This is really stunning work! I don’t know why I haven’t seen this before today.

  31. Martin said 1446 days ago

    thank you very much for this one, i think of using it in a redesign :)

  32. so groovy now :: Lifestream :: I was busy this week! said 1446 days ago

    [...] Sexy Music Album Overlays · Komodo Media — 6:00pm via [...]

  33. Website Redesign | Phil LaPier said 1451 days ago

    [...] of the album covers to the music I am currently listening to – thanks to KomodoMedia for the Sexy Music Album Overlays! In addition, I’ve got my facebook status being piped into the ‘About’ page, of [...]

  34. A said 1452 days ago

    Any chance of you releasing large size versions of those icons?

  35. The Friday Fix June 22 - 26 | Inspiredology said 1454 days ago

    [...] You might have seen my new redesign chadmueller.com and noticed those sweet album covers at the bottom… well courtesy of Komodomedia. [...]

  36. Philipp said 1481 days ago

    Awesome work! Thanks a lot!
    Greetings from Germany

  37. Line said 1482 days ago

    This is absolutely awesome – thank you for sharing!

  38. Zane said 1496 days ago

    We’re using it in our upcomming relaunch which you can see here.

  39. Alex Mcvitie said 1497 days ago

    Fav Post! love how easy this is … must say tho its always good to start with great graphics tho :D <3 photoshop :D

  40. twe4ked said 1499 days ago

    Hey Rogie,

    I used the jewel case here:

    http://inheartswake.com/

    Not for last FM but thankyou so much for releasing them.

    Cheers

  41. Nick said 1500 days ago

    Thanks, I’m using on my site. I even extended it cover my PS3 games.

  42. Mick said 1504 days ago

    Thanks a lot for the help man, really great. Though there do seem to be some problems with the validation of the CSS.
    It claims the rules about the filter and the interpolation mode for IE are not existing or false.

  43. J said 1505 days ago

    How awesome. Thanks, I’m using them at my site!

Sorry, the comment form is closed at this time.