36

Recaptcha is adding a "This frame prevents back/forward cache problems in Safari" iFrame to the top of my website (code included below), which is pushing off the styling by 20-30px (approximately).

If I set display: none; to the element in Firebug it fixed the problem .

Does anyone know why this element has a height (I have no CSS that applies to iFrames)? Or how to set display: none; on it?

<iframe src="about:blank" style="height: 0px; width: 0px; visibility: hidden; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; ">
    This frame prevents back/forward cache problems in Safari.
</iframe>

3 Answers 3

49
+100

Try the CSS below:

/* ReCaptcha Iframe FIX */
iframe {display:none !important;}
header iframe,
section iframe,
footer iframe,
div iframe { display:inline; }

If you don't have any other frames on the site to worry about, a simpler version should suffice:

iframe {display:none !important;}

Alternatively, you could target all iframes where src="about:blank":

iframe[src="about:blank"]{display:none;}
3
  • Here are 10 thank you points for solving my same problem on a heart beat! =P
    – Manatax
    Commented Jan 7, 2013 at 9:13
  • 1
    +1, And this is the kind of stuff that just drives a man insane! Commented Jun 5, 2013 at 1:23
  • 2
    THANK YOU for this. This was really driving me nuts. Side note: the reCAPTCHA API is pretty miserable... whoever designed that makes me want to die.
    – wnajar
    Commented Jun 12, 2013 at 8:53
24
iframe[src="about:blank"]{display:none;}

This matches all iframes with the "src" attribute of "about:blank".

1
  • from @OwenMelbourne: should have been src not href for iframes
    – Imre L
    Commented Aug 30, 2012 at 15:58
5

This seems simpler and more accurate:

body > iframe { display:none !important; }

Not the answer you're looking for? Browse other questions tagged or ask your own question.