sebap123 sebap123 - 10 months ago 68
CSS Question

Embedding facebook post on responsive website

I want to embed some Facebook posts (images) on my website, which is intended to be responsive. I am using bootstrap as a main frame for everything and it is very easy to get typical image responsiveness.

Unfortunately with Facebook posts those are

objects and they don't want to scale so nicely.

For my tests I am using this iframe:

<div class="iframe_div">
<iframe src="" style="border:none;overflow:hidden;width:100%;height:100%;position:absolute;left:0;" scrolling="no" frameborder="0" allowTransparency="true"></iframe>

My problem is that when I am changing the size of the window I can sometimes see whole post and other time only top half of it. Well, more precisely it is gradually changing between those two values. Good thing is that it is never too wide, but it is not height enough to display whole.

Another issue is that it overlays the text below it, and only if I'll set some fixed value for
I am able to see it, but then it is not responsive design.

Does anyone managed to embed facebook post in responsive design page?


you have to style the container of iframe try this :

.post-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 35px;
height: 0;
overflow: hidden;

you also need to style iframe like :

position: absolute;
left: 0;
width: 100%;
height: 100%;

you can customize padding for your post.