4

Is there a way to CSS-style a 3rd party iframe? For example, with a Twitter widget, I would like to change the font size.

How would I do this?

David542
  • 104,438
  • 178
  • 489
  • 842

1 Answers1

2

I don't think you do... For all intents and purposes that iframe is another document and is completely outside of your control (as long as it's 3rd party and / or stored in another domain).

In the case of twitter you can always configure the widget itself when you start it but as long as you're trying to access / alter most properties of the document inside the iframe, you're sold.

Long story short: as far as I know you're dependant on whatever tools the 3rd party provides you. Of course, you can always do hacks (intensive curl calls, parsing and rewriting) but that would be like killing a fly with a really big cannon.

What are you exactly trying to achieve?. Maybe there's a way the 3rd party allows you to...

The Marlboro Man
  • 971
  • 7
  • 22
  • Change the font size...Can you add css after the fact with javascript? – David542 May 10 '13 at 05:03
  • David: I don't really think you can. Using Javascript to access a document into an iframe is "permitted" but most of the time you will only be able to read information (and not a great set of it, to be honest). Same rules apply in the case of, for example, trying to using iframes and JS to read the contents of another site so you can copy them. As for css goes, I don't think that iframe.myframe document body div.this_thing {font-size: 11px} is going to do anything at all. I know it sounds a bit odd since, after all, all that text **IS** in your computer, but that's the way the security goes. – The Marlboro Man May 10 '13 at 05:14