使用twitter bootstrap 2在Rails中水平对齐radio_button_tag和label_tag?

Ada*_*amT 3 css ruby-on-rails twitter-bootstrap

我似乎无法将radio_button_tag与其label_tag水平对齐.(使用HAML)

=radio_button_tag(:animal, "dog")
=label_tag(:animal, "Dog")
Run Code Online (Sandbox Code Playgroud)

我为这两个表单助手分配了哪些类,以使它们彼此相邻,如下所示:

O Dog
Run Code Online (Sandbox Code Playgroud)

Thi*_*ilo 5

使用.form-inline的封闭形式,标签通常解决我遇到任何垂直对齐的问题,虽然它可能不适合所有的情况.

更新

Bootstrap现在还有几个类可以应用于封闭块,以便分别使用以下文本排列复选框和单选按钮.从他们的文件:

<label class="checkbox">
  <input type="checkbox" value="">
  Option one is this and that—be sure to include why it's great
</label>

<label class="radio">
  <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
  Option one is this and that—be sure to include why it's great
</label>
<label class="radio">
  <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
  Option two can be something else and selecting it will deselect option one
</label>
Run Code Online (Sandbox Code Playgroud)

它不必是标签 - 任何块元素都应该起作用.

请参见此处:http://twitter.github.com/bootstrap/base-css.html#forms("复选框和无线电"部分).