【问题标题】:Can't center old reCaptcha code无法将旧的 reCaptcha 代码居中
【发布时间】:2014-12-04 00:49:35
【问题描述】:

我正在使用来自 reCaptcha 的旧代码,我正在尝试将其置于表单的中心,但它不起作用。

我尝试了什么:

margin:0 auto;
margin:0 auto !important;
text-align:center;

HTML:

<p class="captcha">
    <script type="text/javascript">
        var RecaptchaOptions = {
        lang : 'en',
        theme : 'white',
        tabindex : 9
        };
    </script>
    <script type="text/javascript" src="http://api.recaptcha.net/challenge?k=..."></script>
<noscript>
    <iframe src="http://api.recaptcha.net/noscript?k=..." height="300" width="500"></iframe><br/>
    <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
    <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
    <span class="validation-error"></span>
</p>

【问题讨论】:

    标签: javascript html css captcha


    【解决方案1】:

    使用:

    text-align:center;
    

    在表单元素不起作用时,浏览器从未实现该功能。您需要做的是像这样在 CAPTCHA 周围包裹一个 div:

    <div align=center><CAPTCHA></div>
    

    【讨论】:

    • 好的,它可以工作,但它不是 HTML5 有效的,那是因为我尝试了 text-align。
    猜你喜欢
    • 2015-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-11
    • 1970-01-01
    • 1970-01-01
    • 2013-12-23
    • 2016-02-17
    相关资源
    最近更新 更多