Ivan Topić Ivan Topić - 3 years ago 148
CSS Question

How to target image inside iframe

How can I target image inside iframe with CSS?

This doesn't work

iframe img {
height: auto;
width: 100%;

enter image description here

Answer Source

try jquery for this

$('iframe').contents().find('img').css({with: '100%', 'height': '100%'});

wrap this in jQuery load callback if iframe loads later after page loaded

$('iframe').load(function() {
    $(this).contents().find('img').css({with: '100%', 'height': '100%'});
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download