How-to Colour and Size Facebook Like Buttons

Adding social media to your website is common now-a-days and it is a great way of getting attentions and using your website visitors to easily and freely share your content. One way of doing this is adding Facebook like buttons to your website, so that your visitors can like your Facebook page.To get your Facebook like button, you can go here.

The Problem

Facebook Like Button

The problem that everyone will come across with the Facebook like button is that it’s small and blue, which is Facebook’s default colour. But, don’t worry, we can change the colour and size of the Facebook like button and this tutorial will show you how-to do just that, change the colour and size of Facebook like buttons.

Sizing Facebook Like Buttons

The HTML code that displays the Facebook button will look something like this:

What is key is the class, in this case it is fb-like. You’ll be using CSS throughout this tutorial that targets this CSS class.

To change the size, we’ll be using CSS3 transform property with a scale value. The CSS3 transform property is available in Chrome 36.0+, IE 10.0+, Firefox 16.0+ and Opera 23.0+. Here is the CSS:

.fb-like { transform: scale(2.5); -ms-transform: scale(2.5); -webkit-transform: scale(2.5); -o-transform: scale(2.5); -moz-transform: scale(2.5); }

You’ll notice 2.5 which is the scale value. So, in the example, the button will be 250% larger then the original; a value of 2 would be the button will be double the size.

The result for the example is:

Large Facebook Like Button

When enlarging the Facebook like button, we might have to increase the margins above and below the button. This can easily be done by adding the margin property to the CSS class like so:

.fb-like { margin-top: 25px; margin-bottom: 25px; /* the short way of doing this is margin: 25px auto; */ }

Colouring Facebook Like Buttons

Unfortunately, colouring the Facebook like button with CSS will only work in Chrome, Safari and iOS 6 browsers.

To colour the Facebook like button, we’ll be using CSS filters. CSS filters property will provide us access to the hue-rotate effect. The hue-rotate effect will allow us to change the hue of the button based on 360 degree plate of colours.

The CSS will look like this:

.fb-like { filter:hue-rotate(Xdeg); -webkit-filter: hue-rotate(Xdeg); }

In the above example, you’ll see X right beside deg. You should replace the X only with a number value. An example of this is:

.fb-like { filter:hue-rotate(240deg); -webkit-filter: hue-rotate(240deg); }

This would produce a green button:

Green Facebook Like Button

Here are some more examples of coloured Facebook like buttons:

Red, Brown and Blue Green Facebook Like Buttons

Red = 120deg; Brown = 180 deg; Blue-ish Green = 300deg.

Have Fun!