None of the CSS solutions worked for me as of March 2014. It looks like Facebook has changed the plugin to now set the width in the container in the iFrame, which you cannot override with CSS.
After a little digging, I noticed that the width of the comments is actually controlled by the last parameter iframe src width=XXX . With that in mind, here is how I decided it:
// ON PAGE LOAD setTimeout(function(){ resizeFacebookComments(); }, 1000); // ON PAGE RESIZE $(window).on('resize', function(){ resizeFacebookComments(); }); function resizeFacebookComments(){ var src = $('.fb-comments iframe').attr('src').split('width='), width = $('#container').width(); $('.fb-comments iframe').attr('src', src[0] + 'width=' + width); }
#container is the width of your container that you want the comment plugin to stretch to fit. Change this to everything you need and this code should work for you.
I use a timeout because I could not start it when the iframe was loaded. Any help on this would be appreciated, but a timeout does the job.
EDIT: This solution causes the back button to break. I am testing this solution now, and it seems to me that it is better: https://stackoverflow.com/a/3166/
Ryan Mar 05 2018-12-14T00: 00Z
source share