我已经尝试了我可能想到的所有事情,并且查看了文档/ tutorials/github自述文件的每一处。中心水平形式的twitter引导
我正在构建一个简单的使用简单窗体和twitter引导的rails应用程序。
我想我的形式是在页面的中心,我可以得到场在我的引导css文件中添加此移动到中心:
body {
text-align: center;
}
导致:
无论我做什么,我都无法将标签“control-label
”与中心对齐。我曾尝试在其他许多方面使用id
。
这里是我的表单代码:
<%= simple_form_for @message, :html => { :class => 'form-horizontal' } do |f| %>
<%= f.input :phone, :input_html => { :maxlength => 10 }, :label_html => { :class => 'control-label' } %>
<%= f.input :message %>
<div class="form-actions" id="sendbtn">
<%= f.button :submit, :class => 'btn-primary' %>
</div>
<% end %>
和生成的html:
<div class="container">
<div class="page-header">
<h1 id="pagetitle">New Message</h1>
</div>
<form id="new_message" class="simple_form form-horizontal" novalidate="novalidate" method="post" action="/messages" accept-charset="UTF-8">
<div style="margin:0;padding:0;display:inline">
<div class="control-group tel optional">
<label class="tel optional control-label control-label" for="message_phone">Phone</label>
<div class="controls">
<input id="message_phone" class="string tel optional" type="tel" size="50" name="message[phone]" maxlength="10">
</div>
</div>
<div class="control-group text optional">
<label class="text optional control-label" for="message_message">Message</label>
<div class="controls">
<textarea id="message_message" class="text optional" rows="20" name="message[message]" cols="40"></textarea>
</div>
</div>
<div id="sendbtn" class="form-actions">
<input class="btn btn-primary" type="submit" value="Create Message" name="commit">
</div>
</form>
</div>
请任何人都可以在这里提供一些支持?
抱歉,我对这一切都有点新鲜感,我不太确定如何实现这一点。我在jsfiddle中看到了这个例子,但我不确定我需要添加到我的'_form.html.erb'中以生成适当的标记,这将允许我以这种方式添加css。 – ohayon
我想,更具体地说,你是什么意思的“声明在我的窗体内嵌块'的容器div? – ohayon
编辑!!!谢谢!!!我把一个div围绕我的轨道形式标签,它的工作! – ohayon