Change width for an input on Bootstrap3 horizontal forms

[亡魂溺海] 提交于 2019-12-23 21:00:44

问题


Reading django-crispy-forms I noticed than:

The way you do horizontal forms in Bootstrap version 3 is setting some col-lg-X classes in labels and divs wrapping fields. This would mean a lot of hassle updating your layout objects for settings these classes, too much verbosity. Instead some FormHelper attributes have been added to help you easily achieve this.

And an example is provided:

helper.label_class = 'col-lg-2'
helper.field_class = 'col-lg-8'

My question is:

How can I change default label_class or field_class for a form field?

In bootstrap doc sample:

helper.label_class = 'col-lg-2'
helper.field_class = 'col-lg-8'
helper.layout = Layout(
    'email',            #<--- How to set class to 'col-lg-4' only for this field?
    'password',
    'remember_me',
    StrictButton('Sign in', css_class='btn-default'),
)

来源:https://stackoverflow.com/questions/22756731/change-width-for-an-input-on-bootstrap3-horizontal-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!