[英]Twitter bootstrap “lead” not working with simple_form
I'm using Twitter Bootstrap along with simple_form in Rails. 我在Rails中使用Twitter Bootstrap和simple_form。 For some reason I cannot get the Bootstrap class="lead" to function. 由于某种原因,我无法使Bootstrap class =“ lead”起作用。 I see in the rendered HTML some additional classes which I assume come from simple_form. 我在呈现的HTML中看到一些其他类,这些类假定来自simple_form。 How can I get the two to play together? 我怎样才能使两者一起玩?
This is my code: 这是我的代码:
<p class="lead">
<%= sentence.input :dialog, :input_html => { :class => "span8" },
:placeholder => "Enter your sentence here", :label => false %>
</p>
And this is the rendered HTML: 这是渲染的HTML:
<p class="lead">
<div class="control-group string optional">
<div class="controls"><input class="string optional span8" id="dialog_catagory_dialogs_attributes_0_dialog" name="dialog_catagory[dialogs_attributes][0][dialog]" placeholder="Enter your sentence here" size="50" type="text" />
</div>
</div>
</p>
EDIT I've tried various options, including using the rendered HTML, like this and removing the divs. 编辑我尝试了各种选项,包括使用呈现的HTML,像这样并删除div。 Still not working. 还是行不通。
<p class="lead">
<input class="string optional span8" id="dialog_catagory_dialogs_attributes_0_dialog" name="dialog_catagory[dialogs_attributes][0][dialog]" placeholder="Enter your sentence here 2" size="50" type="text" />
</p>
output 输出
<p class="lead">
<input id="dialog_catagory_dialogs_attributes_0_dialog" name="dialog_catagory[dialogs_attributes][0][dialog]" size="30" type="text" />
</p>
Here's the problem: Placing a div
inside of a p
element implicitly closes the p
tag in standards-confirming browsers. 问题是:在确认标准的浏览器中,将div
放在p
元素内隐式关闭p
标签。 ( Reference ) ( 参考 )
You can see (and modify locally, if you wish) the behavior of Simple Form's Bootstrap generators in this file on Github . 您可以在Github上的该文件中看到(如果需要,可以在本地修改)Simple Form的Bootstrap生成器的行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.