Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于显示为块和内联元素的表单(ruby on rails、css)_Css_Ruby On Rails - Fatal编程技术网

用于显示为块和内联元素的表单(ruby on rails、css)

用于显示为块和内联元素的表单(ruby on rails、css),css,ruby-on-rails,Css,Ruby On Rails,对于block,是否可以将某些元素显示为block,而将某些元素显示为inline?我在块的表单_中有几个元素。第一个我想单独显示在一行上,另外两个(收集、选择和提交)我想一起显示在同一行上。这可能吗 这是我的密码: <div class="container form-group"> <%= form_for(@comment) do |f| %> <%= render 'shared/error_messages', object: f.object %

对于block,是否可以将某些元素显示为block,而将某些元素显示为inline?我在块的
表单_中有几个元素。第一个我想单独显示在一行上,另外两个(收集、选择和提交)我想一起显示在同一行上。这可能吗

这是我的密码:

<div class="container form-group">
  <%= form_for(@comment) do |f| %>
  <%= render 'shared/error_messages', object: f.object %>
  <%= f.hidden_field :problem_id, :value => @problem.id %>

  <%= f.label :content, "Add Comment:" %>
  <%= f.text_area :content %>

  <%= f.label :comment_type, "Comment Type:" %>
  <%= collection_select(:comment, :comment_type_id, CommentType.all, :id, :name, prompt: false) %>

  <%= f.submit "Add" %>
<% end %>
</div>

@problem.id%>
我想收集你选择和提交在同一行基本上。我该怎么做? 我假设这是一个CSS问题,但我可能错了。另外,如果有什么变化的话,我正在使用引导sass gem。

看一看。然后您可以手动添加

标记吗?那是又快又脏的

但是,在rails中将类添加到表单时,需要执行以下操作

<%= form_for @comment, html: {class: 'form-inline', role: form} do |f| %>


您还可以覆盖返回到您身上的元素。标签可能对你有影响。你知道如何在浏览器中检查吗?

嘿,谢谢。看来这就是我需要的。由于某种原因,我不能让它工作,虽然。。。我会继续努力的,一定是这样。好吧,我知道了。虽然我的解决方案仍然有点糟糕,但实际上表单内联不起作用。相反,我使用了带有特定列xs-#和列xs拉-#类的form horizontal。很好!bootstrap是一个很好的工具,但是经常会涉及到黑客攻击,lol@fatuhoku角色?需要一些看起来像的引语。