1

I have some problems using a custom CSS with iframe in Blogger. I tried to link the CSS in the HTML page to edit the iframe style but nothing worked, I also tried to write the CSS directly in the HTML page but nothing worked.

I want to use a custom CSS for the iframe that I have on my Blogger website.

Is there any solution for this problem?

Manos Nikolaidis
  • 21,608
  • 12
  • 74
  • 82

1 Answers1

0

It is you answer: How to apply CSS to iframe?

Edit: This does not work cross domain.

There are two different things here: the style of the iframe block and the style of the page embedded in the iframe. You can set the style of the iframe block the usual way:

<iframe name='iframe1' id="iframe1" src="empty.htm" 
        frameborder="0" border="0" cellspacing="0"
        style="border-style: none;width: 100%; height: 120px;"></iframe>

The style of the page embedded in the iframe must be either set by including it in the child page:

<link type="text/css" rel="Stylesheet" href="Style/simple.css" />

Or it can be loaded from the parent page with Javascript:

var cssLink = document.createElement("link") 
cssLink.href = "style.css"; 
cssLink.rel = "stylesheet"; 
cssLink.type = "text/css"; 
frames['frame1'].document.body.appendChild(cssLink);
Community
  • 1
  • 1
Daniel Mizerski
  • 1,123
  • 1
  • 8
  • 24