Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap using block level labels and inputs

I am using Twitter bootstrap for Rails/SASS and have notice that it applies a display: block; style to my labels,label inputs and label textareas.

I am using form tags to generate a check box with a label, but the block style move the two onto different line:

  <%= f.check_box :remember_me %>
  <%= f.label :remember_me %>

My question is two fold. Should I be doing it this way? and if so how best should I override Twitter Bootstraps defaults. I would rather not have lots of !important flags in my CSS if I can avoid it.

like image 549
Mild Fuzz Avatar asked May 10 '12 10:05

Mild Fuzz


1 Answers

you can do it the bootstrap way and pass in a label block

<%= f.label :remember_me, :class => "checkbox" do %>
  <%= f.check_box :remember_me %>remember me
<% end %>

on this way the checkbox also gets checkt if you click on the text. Much nicer!

like image 197
HaNdTriX Avatar answered Oct 01 '22 13:10

HaNdTriX