Facebook like box widget not recognizing data-width attribute?

后端 未结 9 2487
醉话见心
醉话见心 2021-02-19 07:26

I just noticed today that the data-width attribute for the Facebook Like Box widget does not appear to be working. It looks like it is reverting to the default width. An example

9条回答
  •  北恋
    北恋 (楼主)
    2021-02-19 08:15

    Expanding on user2477225's answer, it might have problems with custom positioning that you set (relative or absolute somewhere on the page), so what I did was:

    .fb_iframe_widget>span { width: 240px !important; }
    .fb-like-box iframe { width: 240px !important; }
    

    Seems to be working so far.

    Edit: For IE 8 (and lower), please use this instead:

    .fb_iframe_widget span { width: 240px !important; }
    .fb-like-box iframe { width: 240px !important; }
    

    I like to be as specific as possible in my selectors, but after checking this issue some more, I see no technical reason to use the > selector here.

提交回复
热议问题