Style the Facebook Like (or Fan) Box

Posted on Thursday 27th Jan 2011 by Luci Smethurst 5 Comments

A great way to encourage some easy interaction from your visitors with your site, and to promote it to a wider audience, is to add a Facebook Like Box to your site (previously known as a Facebook Fan Box). The one downside to the default options of the Facebook Like Box is that it’s pretty unimpressive looking, and never really ‘fits’ with the style of a site.

But, it doesn’t have to be that way!

As long as you remember a few key points it’s just as easy as styling any other set of elements in your web design.

1: The new Like Box doesn’t support CSS yet, not as far as I could test anyway. So, you need to use older Fan Box code instead,

<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"><!--mce:0--></script>
<script type="text/javascript"><!--mce:1--></script>

2: Getting an API key is easy – there are plenty of how-to’s a short search away, so I won’t bore you with the details. Then you need to enter your profile ID (the numerical id of your page, not the name of it) and link up your stylesheet. You’re nearly set!

3: At the end of the CSS variable above, you will see there’s a “?1″ – this is because your stylesheet in the link will get cached as soon as you load the page. So start with a 1, and then every time you make changes that will update the Facebook Fan Box, then just increase the number by 1 (so after the next upload, it will need to be “?2″.

Once you’re all set up, it’s as simple as cracking open Firebug and styling  up as needed. For example,

.app_content_125422374187757 .fan_box .full_widget {
background: none repeat scroll 0 0 transparent;
border: 0 none;
}

Will strip out the pale background and border that encompasses the box by default, and:

.app_content_125422374187757 .full_widget .name_block {
display: none;
}

Will hide the “(your-page-name) on Facebook”, so you keep focus on the ever important “Like” button. That’s it in a nutshell – if you have any questions feel free to comment below!

About Luci Smethurst

Luci likes geeky things, green things, and chocolate. That pretty much sums her up, really.

See all of posts.

Add on Luci Smethurst Google+

Luci Smethurst's Tweet's

  • @missrachilli hold out! you can do it -strepsil it up! Go by the 3 day rule - day 1: bad; day 2: awful; day 3: (a bit) better :) Less than 1 minute ago!
  • RT @daniel_c_long: Cool Photoshop action to remove gradient banding http://t.co/XQ2lUZoj via @brdrck Less than 1 minute ago!
This entry was posted in HTML & CSS Tutorials and tagged , . Bookmark the permalink.

5 Responses to Style the Facebook Like (or Fan) Box

  1. Jim says:
    January 31, 2011 at 7:10 pm

    This is a great tutorial, but I have a question…

    I’m trying to style a fb fan-box for a fan page, not an application. Is there any way to get the fan-box point to the fan page instead of the application page?

  2. Luci says:
    February 1, 2011 at 8:47 am

    Hi Jim,

    I’m fairly sure it’ll work the same way – grab your fan page profile ID and pop it into the profile_id box. I think when I was giving this a go it was for a normal Fan page as well.

    If you’re not sure where to find your profile ID, the post below shows you quite nicely:
    http://crenk.com/where-do-i-find-my-facebook-fan-page-public-profile-id/

    Let me know how you get on!

  3. Domenic says:
    March 10, 2011 at 7:17 pm

    Hello,

    It looks like Facebook has either changed or removed the method by which you can style your like-box (using the ‘css’ attribute in the tag). Is there another way? Do I have to use FB.XBFML.parse() function somehow? Arghh…FB and its countless monthly changes. If something isn’t deprecated, it’s completely changed.

  4. Luci Smethurst says:
    March 10, 2011 at 8:49 pm

    Hi Domenic,

    Pesky Facebook! Bear with me, I’ll try and sit down in the next week or so to get the new method down. I’ll update this post with the new method as soon as it’s done.

    Thanks for the heads up!

  5. Ted says:
    July 5, 2011 at 9:12 am

    Nice post Luci! However, I’m a bit lost here…

    So… I’ll use facebook’s official Like Box to generate the code… and then place it where??

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>