开发者

How can I apply a top margin to my Html.BeginForm

I have this code:

<div class="mdl_bdy_frm">
   @using (Html.BeginForm())
            {

            @Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.") 

            @Html.LabelFor(m => m.Login.UserName, new { @class = "adm" })
            @Html.TextBoxFor(m => m.Login.UserName, new { @class = "adm", size = 30 })
            @Html.ValidationMessageFor(m => m.Login.UserName)

            @Html.LabelFor(m => m.Login.Password, new { @class = "adm" })
            @Html.PasswordFor(m => m.Login.Password, new { @class = "adm", size = 30 })
            @Html.ValidationMessageFor(m => m.Login.Password)
            <br />
            @Html.CheckBoxFor(m => m.Login.RememberMe, new { @class = "adm" })
            @Html.LabelFor(m => m.Login.RememberMe, new { @class = "adm" })

            <p><input type="submit" 开发者_高级运维value="Login" /></p>

        }
</div>

Is there a way that I can give my HTML.BeginForm at top-margin style? If possible I would like to do this with an inline style as its just used in the one place.


You could just add padding to the parent div.

<div class="mdl_bdy_frm" style="padding-top:20px;">


Html.BeginForm( ..., ..., ..., New With {.style = "margin-top:20px;"})

See: How to add id HTML attribute in ASP.NET MVC w/ VB.NET


@using (Html.BeginForm("ActionName", "ControllerName", FormMethod.Post, new { style = "margin: 10px;" }))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜