1

I am trying to display an image in iframe, image is larger than the iframe. Can I make it fit using HTML ?

Photo is 400 x 200, my iframe is 200x100, Is there an HTML coded iframe that will automatically fit the image to the iframe border?

mplungjan
  • 169,008
  • 28
  • 173
  • 236
user3796310
  • 11
  • 1
  • 2
  • 1) why iframe, why not div? 2) http://stackoverflow.com/questions/3029422/image-auto-resize-to-fit-div-container http://stackoverflow.com/questions/19779305/make-responsive-image-fit-parent-container http://stackoverflow.com/questions/16037566/make-an-image-fit-its-container-by-setting-the-image-height-to-the-containers-he – mplungjan Jul 02 '14 at 05:33
  • No, you can't. Unless you have access to the source code of the file within the iframe, and this way you can set a class to it with a code like `img.some_class { max-width:100% !important; max-height:100% !important; display:block;}`. But you can't style elements inside an iframe with CSS placed on the parent document (iframe holder). – Frondor Jul 02 '14 at 07:01

1 Answers1

-1

use seamless attribute in iframe :
<iframe src="demo_iframe.htm" seamless> </iframe>
And Css
iframe img{width:200px;}
Note : The seamless attribute is not supported in IE, Firefox, Opera 12 and earlier versions.

Rahiil
  • 110
  • 1
  • 11