【问题标题】:Alignment of Google ReCaptcha v2 bootstrapGoogle ReCaptcha v2 bootstrap 的对齐方式
【发布时间】:2016-01-27 18:10:23
【问题描述】:

我想知道是否有人可以帮助解决我遇到的问题。我有一个表格,我将 ReCaptcha v2.无论我尝试什么,我都无法让 ReCaptcha 与表单的其余部分正确对齐,这些表单将直接位于文本框下方,并在左侧写入。如果有人能帮我解决这个问题,我将不胜感激

表格

@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{

@Html.AntiForgeryToken()
@Html.ValidationSummary("", new { @class = "text-danger" })

<div class="form-group">
    @Html.LabelFor(m => m.FirstName, new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
        @Html.TextBoxFor(m => m.FirstName, new { @class = "form-control" })
    </div>
</div>

<div class="form-group">
    @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
        @Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
    </div>
</div>
<div class="form-group">
    @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
        @Html.PasswordFor(m => m.Password, new { @class = "form-control" })
    </div>
</div>
<div class="form-group">
    @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
        @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
    </div>
</div>

<style>
    div.g-recaptcha {

        left: 0px;
        width: 304px;
    }
</style>

<div class="form-group">
  Are You Human
    <div class="col-md-10">
        <div align="center" class="g-recaptcha" data-sitekey="sitekey"></div>
    </div>
</div>


<div class="form-group">
    <div class="col-md-offset-2 col-md-10">
        <input type="submit" class="btn btn-default" value="Register" />
    </div>
</div>
}

正在发生的事情的图像。

理查方法

【问题讨论】:

    标签: c# css forms twitter-bootstrap razor


    【解决方案1】:

    您尚未设置标签样式。将它放在 col-md-2 中以将内容推送过来。您还需要删除align="center",并且可能需要将form-control-static 添加到验证码的类中。

    <div class="form-group">
        <label class="col-md-2 control-label">Are You Human</label>
        <div class="col-md-10">
            <div class="form-control-static g-recaptcha" data-sitekey="sitekey"></div>
        </div>
    </div>
    

    【讨论】:

    • 感谢您的回复,与您的方法不一致。我会将输出的图像添加到帖子的末尾。
    • 已更新 - 你也有一个 align=center ,这可能会搞砸。
    • 感谢您解决了这个问题。
    猜你喜欢
    • 2023-03-05
    • 1970-01-01
    • 2015-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-25
    • 1970-01-01
    相关资源
    最近更新 更多