Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

iframe external css files

10:00 am on Aug 18, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Apr 28, 2009
votes: 0

I have a website that has an iframe called on the page that is filled with another website that calls a only-when-viewed-in-an-iframe stylesheet. Would a css file from the main site overwrite styles of the iframe stylesheet for elements in the iframe?

<html><body><head><link rel="stylesheet" src="style.css" /></head><iframe src="mysite.com"></iframe></body></html>

So would the styles in style.css overwrite the styles set in the stylesheet that is called with mysite.com from the iframe?
4:02 am on Aug 20, 2010 (gmt 0)

New User

5+ Year Member

joined:Aug 17, 2010
votes: 0

If I understand your description correctly. Nope.

The contents of the <iframe> are like a whole separate browser window. In fact, unless the parent and the <iframe> source come from the exact same domain name, I don't think they can have any interaction at all, as a security precaution.

BTW, I notice your code above has a bug in it. <head> should close before <body> opens. I hope you've got it that way on the live page.