Archived topic
CSS apply if the page is displayed in a frame
15 replies · Started by Oleg on September 19, 2015
Tom, tell me if this is possible. Apply CSS, only in the event that the page is displayed in another place by frame. Maybe with another plugin. I found a plug-in "Fresh Custom Code", it allows you to set the conditional logic for displaying CSS, for example, post categories or mobile devices, but no frames.
What do you mean by frames? IFrames?
Yes.
You'd just put iframe in front of your CSS selectors.
iframe .my-class {
}
I try:
iframe {
.site-header {display:none;}
.site-info {display:none;}
}
does not work.
but is working
iframe {
margin-top:50px;
margin-left:0px;
}
but you need it - site-header, site-info
It would be:
iframe .site-header,
iframe .site-info {
display:none;
}
No, it does not work either. What could be wrong?
I'm not sure - this is more of an HTML issue than a GP/WordPress issue.
The code I gave above will work if you have those elements (.site-header and .site-info) inside an iframe element (no idea why this would be the case).
Either way, you'll need to either adjust your HTML or CSS.
Tom, see for yourself.
Completely clean installation WordPress and GeneratePress.



Site: http://olegte.bget.ru/wp-admin/, login/password for admin - demo/demo.
I'm not seeing that on this page?: http://olegte.bget.ru/iframe/
Have you removed it?
No, there is only the name of the "IFRAME" and the word "text" in the content.
Just looked it up - it's not possible: http://stackoverflow.com/questions/3564466/how-to-hide-an-element-inside-html-iframe
It says about the pages on a different domain. In my case the page on the same domain. ?
Then why not just hide the site header and other elements on that site before embedding it in an iframe?
From what I've read, it's not possible to apply CSS to the contents of an iframe.
I want to make sure that the page can be opened from another location in the pop-up window, in an abbreviated form.
