I am trying to change the width of my advertising image from pixels to percentages. I use Google DoubleClick or "DFP". It automatically puts your image in an iframe, which makes it very difficult to change the actual size of the image.
So, as I changed the width of the images from pixels to percent, I made a div (this is 90% of the web page) wrapped around the image ad and then set the image width to 100%, so when the width of the wrappers changes when the browser is resized, the image is inside it will always fill the shell. But I do not know how to do all this, since the image is inside the iframe (stupid DFP !!!)
Here are the CSS codes for ... wrappers:
#div-gpt-ad-1362958263281-0 {width:90%; border:1px solid black;}
then the iframe that is in the wrapper:
iframe {width:100%;}
and then the actual image in which I tried several CSS selectors and different div classes:
.img_ad, a#aw0, iframe>.img_ad, iframe>#google_image_div>.img_ad {width:100%; display:block; border:1px solid red !important;}
If you test an element in Google Chrome on an ad image, you will see that CSS does not apply to the image. All I would like to do is change the width of the images as a percentage .. as well as the height to auto . Is it really that hard? Is this possible since the image is in an iframe? Is DFP for failure? I just donβt know ... But how would I change the code for the ad code? Any help will really be really appreciated by the guys! :)
Here is jsFiddle: http://jsfiddle.net/EptwH/3/
source share