Dancer
Dancer

Reputation: 17671

Inject Style-sheet into Iframe (Facebook Like Box)

We are trying to style a Facebook like box which annoyingly has fixed image widths/heights set and borders which ruin our design. We would like to overwrite a couple of the styles to suit.

The Likebox is embedded using an iframe.

Is it possible to inject a stylesheet into an IFrame? Using Javascript possibly? Or does anyone have any other suggestions?

Thanks Paul

Upvotes: 1

Views: 7183

Answers (2)

Hendra Ndra Nugraha
Hendra Ndra Nugraha

Reputation: 12

Yes, you can do it yourself. You can styling everything of Facebook Like Box with custom CSS code. Visit this tutorial at: DaddyDesign: Styling Facebook Like Box

Upvotes: -2

josh3736
josh3736

Reputation: 144912

No, you can't inject CSS, and that's by design.

The same-origin policy prevents you from accessing or modifying the content in the iframe.


You can add height and width and data-border-color attributes to your <iframe> to tell Facebook what size and border color you'd like (subject to minimums). Set the border color to match your background to make it look like there's no border.

See the docs for more info.

Upvotes: 4

Related Questions