I think, therefore I blog

How To Remove The Border From Facebook and YouTube Widgets

By , 21 April 2011

How To Remove The Border From Facebook and YouTube Widgets

Facebook and YouTube have neat little widgets to help your website visitors easily subscribe to your videos and like your facebook page. The only problem is they both went ahead and put dog ugly borders around their widgets which you can't style using css because it's all in an iframe. Fortunately, we can still style our own content and here is a little trick you can use to hide those pesky borders.

It works by simply tucking the iframe under a div on your site. The markup and css looks like this:

How To Remove The Border From Facebook and YouTube Widgets
<div style="overflow: hidden; width: 248px; height: 450px;">
  <iframe src="http://www.facebook.com/plugins/likebox.php?href=xxx"/>
          scrolling="no" frameborder="0" allowTransparency="true" 
          style="margin: -1px; width: 250px; height: 475px;">

Do the maths on those widths and margins, and you'll see that the iframe is two pixels wider than the div with a -1 pixel margin on each side. Goodbye borders! Note the wrapping div is 25px shorter than the iframe to hide the Facebook Like Box developer link. You could always change that if you wanted.

Same deal with the YouTube widget, just experiment with the dimensions until you're happy.

Hope that helps.


About Roger Keays

How To Remove The Border From Facebook and YouTube Widgets

Roger Keays is an artist, an engineer, and a student of life. Since he left Australia in 2009, he has been living as a digital nomad in over 40 different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, and finding good food. Click here to subscribe to his weekly blog, or stalk him on Facebook and Twitter.

Leave a Comment

Please visit https://RogerKeays.com/blog/how-to-remove-the-border-from-facebook-and-youtube-widgets to add your comments.

Comment posted by: Fabio, 3 years ago

Thank You very very very much!

Join Over 1000 Subscribers

I write every Sunday about travel, psychology, and technology. Thousands of people just like you have already subscribed—and for good reason. It'll change your life. And it's free :)

Read a Good Book

“A spellbinding true story of love, passion and adventure. One can’t help but be swept away by 100% Love Guaranteed.” —Dr Tammie Matson, author of Elephant Dance.

Chat For A While

Your Vote Matters

Which animal will take over when humans go extinct?