How to Add Responsive Facebook Videos to Your Website

How to Add Responsive Facebook Videos to Your Website

Facebook allows you to embed videos from their site in your own website.

However, by default Facebook videos are not responsive.

In this short tutorial, I’m going to show you how to make your Facebook video embeds responsive by adding a few lines of CSS. Let’s start…

EmbedPress - WordPress Embed Facebook Embeds If you’re using WordPress, we highly recommend you check out the EmbedPress plugin. You can create responsive Facebook video Embeds, using just the URL.

Download EmbedPress

Step #1. Get the Facebook video embed code

  • Go to Facebook and find the video you want to embed.
  • Click the down arrow.
  • Click on Embed.

  • Copy the embed code.

Step #2. Use the embed code

Paste the embed code in your website. It will look similar to the example below:

<iframe src="" width="560" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe>

Step #3. Modify the embed code

Wrap the embed code with a div tag. Use the CSS class facebook-responsive; your code now would look like this:

<div class="facebook-responsive">
<iframe src="" width="560" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe>

Step #4. Add the CSS

Add the below CSS properties inside one of your stylesheet files:

.facebook-responsive {
.facebook-responsive iframe {

Your Facebook video embeds now will be responsive. Resize your browser to see it in action.


  • Valentin Garcia

    Valentin discovered Joomla in 2010, and since then he has considered it as the best CMS. Valentin has been coding extensions and templates for Joomla for many years and truly enjoys helping people build their own websites with Open Source tools. He lives in San Julián, Jalisco, México.

0 0 votes
Blog Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
Felipe de Castro

not working.


lol can you state exact error of problem you had?


When its a vertical video, its not working. horizontal yes


Thx for this, Valentin. Would this work in the same way for YouTube videos which, if you just paste in the URL, are not responsive?


Hi allfive, try this tutorial for YouTube: [url=]…[/url]

Analike Emmanuel

I believe simple css styles make YT embed iframes responsive.

Analike Emmanuel

Thanks @ostrainingcomments, it worked


Glad to hear that 🙂


WOOOOOOW! It worked! Thank you so much from Brazil !!!

dragomir voicu

is working perfect, but, how can you limit the width on desktop?


You should use media queries to target a browser width range and then apply different style for width and height and maybe even add max-width and max-height depending on the final result that you would like to achieve


Hey! Thank you for this guide. So far, I was able to add the post in my blogpost. It is even responsive. But: I have several lines of text in the Facebook post. The text will not be displayed if the window is reduced or if seen on mobile. Any suggestions? This is my website: [url=]…[/url]
Cheers from a Swiss guy in Bhutan

José Rubén Juárez Mendoza

It works perfectly.

Jen Mulligan

This fix worked perfectly for me! Thank you so much! Simply awesome!

Caetano Finisterre Burjack

tks a lot… it have solved my problem…

Vũ Hà

Thanks!!! Perfect

Kamlesh Sindhal

its working great job


It worked but it doesn’t show my fb embed’s full post, just the video. How do I show the text and engagement info (number of likes, comments, etc)?


Great work dude! Super simple.


glad you liked it 🙂


is there a way to make it work with the JS API of FB? it states we are supposed to use a div, not an iframe, for example something like:


Hi 1lias3,
Instead of “iframe”, switch it to “fb-video”


Thank you Nick.
it turns out my problem was not related to the way i was embedding the FB videos. i had a bootstrap div: “”
which somehow was blocking the whole video from showing up. i couldnt tweak it, and ended up removing the div…
thank you for your time!

Andrea Urbini

Thanks a lot!! it works great.



unfortunately, it doesn’t work with videos that are in portrait mode. I can only see half of the video..

Daniel Lucindo

How can I style the classes in the iframe?

Vally Pepyako

No way

Lukas Athanasiou

It shows a part of the video in smaller screens.

Rostyslav Shapran

padding-bottom is hardcoded. Height is not responsive


Same issue as Lukas and Jeponks… :(((
Any way to solve it?

This was awesome and worked great. Thanks <3


Hi! Where do I inject this code in Squarespace?

Christian Rea

Simple, clean, took me less than 60 seconds to implement. Thank you Valentin!!


The issue with facebook videos is that they don’t always have ratio 56.25%. When watched directly, there is black background added on the sides (if video is vertical), but when embedded, The video gets cut on the bottom.

Marcelo Cotta

Excelente! Works like a charm, thanks.


Video is loading with Sound and a black screen

Steven Rodriguez

Thanks worked for me!

Robin Long

[quote=Jhon]When its a vertical video, its not working. horizontal yes[/quote]
I have the same problem.

If I adjust this figure: “padding-bottom:56.25%;” to make it work on mobile phones, then it looks like way too much space between the Facebook review and the next item below on a PC which is horizontal.

Is there a solution to this?


This fix worked perfectly for me

kamal hines

Thanks, bro works great…


Thank you so much, works perfectly!

eva peng

Thanks a lot!!Super simple!!!


You are welcome, Eva!


Still works!!
Thanks a bunch


I love youuuuuuuuu!!! Thanks so much!!! It works very well!

Sallu bro

It’s working great.

Sallu bro

thanks a lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Thanks man, works perfectly fine for me. Your help is much appreciated!


nice its working thanks

Broc Hite

Thank you, Valentín, for this wonderful post, and for sharing your knowledge.  I think it will brighten the day of several of my colleagues!  I shared your page inside a private Facebook group for my fellow music teachers since we often have a need to embed FB video on our Websites!


Thanks for sharing the blog, Broc!  We are happy that you found answers at OSTraining.  

Would love your thoughts, please comment.x