Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set CSS for iframe from third party site

Tags:

css

iframe

I am trying to style the snapwidget instagram feed, I want to make the border white. This is not a setting of the widget so I tried adding css. It seems that my css is not being detected since the content is in an iframe. Is there a way to force my css on the iframe content?

like image 434
Lumpy Avatar asked Apr 02 '12 15:04

Lumpy


People also ask

Can you change CSS of an iframe?

You can not change the styles of the page that resides within the iframe.

Can iframe use parent CSS?

You can not directly apply styles to the inner IFrame element through parent window CSS class even though its domain is same as parent. As ,(All the iframe's domain is the same as the parent) .. Best thing you can do is ,to add your main style sheet to the IFrame using javascript or jquery.

Can I style an iframe?

Styling the Iframe ContentsIf you can edit the page, then you can add an external style sheet or styles right in the document just like you would style any other web page on your site.


1 Answers

It won't work unless the iframe is on the same domain due to same origin policy. http://javascript.info/tutorial/same-origin-security-policy

Check out Using CSS to affect div style inside iframe for an explanation

like image 167
munnster79 Avatar answered Sep 23 '22 05:09

munnster79