改变asp.net mvc中webforms内容的方向

时间:2018-02-09 16:07:21

标签: c# html css asp.net-mvc

简单地说:我想将“电子邮件”文本移到文本框的右侧,因为我的语言是波斯语。因此,在写完波斯语等效的电子邮件之后,我仍然无法将文本移动到文本框的右侧。

enter image description here

我尝试的解决方案包括:移动这些线:

@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>

这是迄今为止唯一有效的解决方案。但是有更好,更方便的解决方案吗? 我已经尝试在dir="rtl"标记以及htmlp标记内使用div,但它不起作用。 感谢

@model Website_File_Store.Models.RegisterViewModel
@{
    ViewBag.Title = "Register";
}

<h2>@ViewBag.Title.</h2>

@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    <h4>Create a new account.</h4>
    <hr />
    @Html.ValidationSummary("", new { @class = "text-danger" })
    <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>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" class="btn btn-default" value="Register" />
        </div>
    </div>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

enter image description here

1 个答案:

答案 0 :(得分:0)

通过在css样式文件中添加css样式来解决它:

.control-label {
    float: right;
}