Note that there are some explanatory texts on larger screens.

plurals
  1. POApplying CSS within an iFrame
    primarykey
    data
    text
    <p>I'm trying to change the width of my ad image from pixels to percentages. I'm using Google DoubleClick or "DFP". It automatically puts your ad image inside an iframe, making it very hard to change the actual dimensions of the image.</p> <p>So, the way I've gone about changing the images width from pixels to percentage is, I made a div (that is 90% of the webpage) wrapped around the image ad and then set the image's width to 100% so when the wrappers width changes on browser width resize, the image within it will always fill up the wrapper. But I don't know how to make this all work since the image is within an iframe (stupid DFP!!!)</p> <p>Here is the CSS codes for... the wrapper:</p> <pre><code>#div-gpt-ad-1362958263281-0 {width:90%; border:1px solid black;} </code></pre> <p>then the iframe which is in the wrapper:</p> <pre><code>iframe {width:100%;} </code></pre> <p>then finally the actual image in which i tried a few CSS selectors and different div classes:</p> <pre><code>.img_ad, a#aw0, iframe&gt;.img_ad, iframe&gt;#google_image_div&gt;.img_ad {width:100%; display:block; border:1px solid red !important;} </code></pre> <p>If you inspect element in Google Chrome on the ad image, you will see that the CSS isn't being applied to the image. All I'd like to do is change the images width into a percentage.. and also the height to <code>auto</code>. Should it really be this hard? Is this even possible since the image is in an iframe? Is DFP setting me up for failure? I just don't know... But, how would I alter the image ad's code? Any help would truly truly truly be appreciated guys! :)</p> <p>Here is the jsFiddle: <a href="http://jsfiddle.net/EptwH/3/" rel="nofollow">http://jsfiddle.net/EptwH/3/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload