Twitter Bootstrap使用塊級標簽和輸入

[英]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.

我正在使用Twitter引導程序用於Rails / SASS,並注意到它應用了display:block;樣式到我的標簽,標簽輸入和標簽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.

我的問題是雙重的。我應該這樣做嗎?如果是這樣,我應該如何最好地覆蓋Twitter Bootstraps默認值。如果我可以避免它,我寧願在我的CSS中沒有很多!重要的標志。

1 个解决方案



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!




粤ICP备14056181号  © 2014-2021