recaptcha iframe fix

reCaptcha adds an iframe to the body of the page using document.write (so this can be in the middle of your page).  This iframe is set to visibility: hidden and has a css width and height of 0,0 and no border.  However, in chrome at least, it causes about 1em vertical shift of following content due to the height of the body of the about:blank page contained within.

Is this a bug? I don’t know.  Why doesn’t reCapcha fix this?  I don’t know.  But here is a simple fix you can add to your css, that should target only the reCaptcha iframe:-

  /* recaptcha iframe fix */
  body > iframe[src="about:blank"]{display:none;}

About austinfrance

Technical Developer @ RedSky IT / Explorer Software
This entry was posted in css and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s