how to apply css style on iframe content from an external domain? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to apply css style on iframe content from an external domain?

iframe

2nd Sep 2017, 1:12 AM
Muhammad Eltaher
Muhammad Eltaher - avatar
5 Answers
+ 5
from what I have gathered changing css in an iframe may or may not work you can try researching a bit and try but it will not for most sites. this will work on same-origin sites you will need JavaScript https://stackoverflow.com/questions/23873407/how-to-style-inside-an-iframe-from-an-external-domain to override domain this may work https://stackoverflow.com/questions/6494721/css-override-body-style-for-content-in-iframe/13959836#13959836 some old read with which this worked and not worked https://www.sitepoint.com/jquery-change-css-iframe-content/
2nd Sep 2017, 2:44 AM
Lord Krishna
Lord Krishna - avatar
+ 4
If I understood you correctly, you want to apply CSS onto an external website that you're displaying in your iFrame? If so, you don't unless you have access to that external server. PS - If you figure out a way, let me know. :D
2nd Sep 2017, 1:16 AM
AgentSmith
+ 3
This only is possible if the iframe's domain is the same as the parent. If it's the case, then you can set the style of the embed page like that: <link type="text/css" rel="Stylesheet" href="Style/simple.css" /> Source: https://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe
2nd Sep 2017, 1:41 AM
Dapper Mink
Dapper Mink - avatar
0
yeah that's right, we will wait for someone to help us. maybe he has an answer. ok sure I let you know.
2nd Sep 2017, 1:19 AM
Muhammad Eltaher
Muhammad Eltaher - avatar
0
I tried all of that but nothing works
2nd Sep 2017, 2:51 PM
Muhammad Eltaher
Muhammad Eltaher - avatar