I have seen questions here about changing the CSS of iframe content from a parent site/page. However, i want the child page to detect if it is in an iframe and then change the CSS.
Thus this should be in the embedded page:
iframe body{color: red;}
This doesn't work. Is there a way to make it work or do I need to use JavaScript?
gre_gor
6,65412 gold badges103 silver badges105 bronze badges
-
Does this answer your question? Check if parent window is iframe or notAnurag Srivastava– Anurag Srivastava2020年04月19日 18:06:02 +00:00Commented Apr 19, 2020 at 18:06
-
@AnuragSrivastava |Thanks. That is what I used in the end.d786b09987n– d786b09987n2020年05月08日 18:54:03 +00:00Commented May 8, 2020 at 18:54
1 Answer 1
You should apply CSS to the iframe tag.
Like:
iframe {
color: red;
}
This will work as expected.
answered Apr 19, 2020 at 18:06
Rajat Verma
3072 silver badges13 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default