Recaptcha 深色主题显示边缘有额外的空白

Jos*_*725 4 html css iframe recaptcha

我是一名新的 Web 开发人员,试图将最新的 Recatpcha 添加到具有深色背景的网站。它在某些边缘显示有空白 - Recaptcha Google 小组也在讨论最近的一个错误。我正在尝试开发一种解决方法,直到他们修复它。Recaptcha 显示为 iframe - 所以它应该是可配置的 - 但 DOM 中可见的属性都不像“背景”。你如何强制 iframe 背景透明?

我的代码在这里:

<!DOCTYPE HTML>
<head>
  <style>
  body {
      background-color: rgb(30, 30, 40);
  }
  </style>
  <script src='https://www.google.com/recaptcha/api.js?hl=en'></script>
</head>

<body>
  <div class="g-recaptcha" data-theme="dark" data-sitekey="6LcZuQwTAAAAAA-qE3415DMsfeGdeQ6WWlzm4Lqz"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

非常感谢!

乔希

sin*_*ake 5

快速解决:

body {
      background-color: rgb(30, 30, 40);
  }
.g-recaptcha {
    overflow:hidden;
    width:298px;
    height:74px;


}
iframe {
  margin:-1px 0px 0px -2px;  

}
Run Code Online (Sandbox Code Playgroud)

演示:http : //jsfiddle.net/76rkfb2w/

正如@CookieMan 难过的那样,iframe 内容无法设置样式,但是,iframe 的持有者和 iframe 可以自行装箱。所以,这应该适用于深色背景......