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 个解决方案

#1


13  

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

你可以用bootstrap的方式做它並傳入一個標簽塊

<%= 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!

通過這種方式,如果單擊文本,該復選框也會獲得checkt。好多了!


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/05/10/725b8eb41c9a43d1f5c3825a88149e19.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com