css - Bootstrap col-sm-offset-2 does not align button in form -
Why not col-sm-offset-2 line up button with two 'to-sm-2' label above it In the form?
I have to use empty labels For a lame fix (see the button 'one'), but I have to understand how to use cleaner code and to make it correct, all my forms do not have a cool label for buttons.
& lt; Form class = "form-horizontal" role = "form" action = "/ company / create" method = "post" & gt; & Lt; Div class = "form-group" & gt; & Lt;% = label_tag (: name, 'company name:' ,: class => 'control-label col-sm-2')%> & Lt; Div class = "call-sm-4" & gt; & Lt;% = text_field_tag (: name, @ company.name, class = & gt; form-control ')% & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "form-group" & gt; & Lt;% = label_tag (: Category, 'Category:' ,: class = & gt; 'control-label col-sm-2')%> & Lt; Div class = 'col-sm-4' & gt; & Lt;% = Archive_type (Zero ,: Category_date, Category. Ah ,: ID ,: Description ,: include_blank = & gt; Select ')% & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "form-group" & gt; & Lt;% = label_tag (: x, '',: class = & gt; 'col-sm-2')% & gt; & Lt; Div class = 'col-sm-2' & gt; & Lt; Button type = "submit" class = "btn btn-primary" & gt; A & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "form-group" & gt; & Lt; Button type = "submit" class = "btn btn-primary col-sm-offset-2" & gt; Two & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Form & gt; Step 2: Make a DIV around your button. Step 2: Give the class of "col-sm-2 col-sm-offset-2" to the DIV. Step 3: Place your button inside that partition - Step 4: Give me feedback if your problem is resolved & lt; Div class = "form-group" & gt; & Lt; Div class = "col-sm-2 col-sm-offset-2" & gt; & Lt; Button type = "submit" class = "btn btn-primary" & gt; Two & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt;
Comments
Post a Comment