How to apply media query CSS rules to iframe content
20,798
Solved… My iframe width was 960px, so until you don't change width to 320px it could not recognize the media query!!
Thanks all
Author by
Luca Frank Guarini
Updated on October 06, 2020Comments
-
Luca Frank Guarini over 3 years
I've got this set of code I would like to apply to my iframe, but it doesn't work.
@media only screen and (min-width : 320px) and (max-width : 480px) { #postframe article{display:none;} }
Thank you.
-
Neil about 12 yearsWhy can't you serve the frame's document with that CSS in the first place?
-
-
Luca Frank Guarini about 12 yearsOk! For example the last line you wrote should be something like this: frames['#postframe'].document.body.article(display:none); ? And where should i insert media queries?
-
Luca Frank Guarini about 12 yearsI've got a wordpress theme where posts are loaded inside an iframe. The single loop page of projects is named "single.php"… I can't define @media only screen and (min-width : 320px) and (max-width : 480px) { #postframe article{display:none;} } also if I try to write it inside head tag of single.php! Why this?
-
Pavlo over 10 yearsAccept your answer then.