KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm in the process of upgrading my app to Bootstrap 2.1.1 and I need to add a class attribute (class="form-horizontal") to many of the form tags. The problem is, most of the forms use the rather beautiful @using (Html.BeginForm()) { format which I'd rather keep. The obvious way to get the class attribute in there is to use the following overload, for example: @using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal" })) { But I'd rather not do that. What is the best way to add a class attribute to my form? I've thought about using a jQuery document ready handler to .addClass("form-horizontal") to forms, but am worried that users would see the dreaded 'flash of unstyled content'. Another approach might be to use a less -style mix-in, to add the .form-horizontal class to all form style rules but I haven't used less yet, so I'm not sure about this one. Anyone know the best way to solve this problem?
Tags (comma-separated)
Save Edits
Cancel