简体   繁体   English

CSS-Rails 4-Boostrap-

[英]CSS - Rails 4 - Boostrap -

I'm using rails 4 and I have an issue with css : There's a below-navbar div in my application.html.erb which is supposed to be sized to the window size; 我正在使用rails 4,而css却有一个问题: application.html.erb有一个低于navbar的div,应该将其调整为窗口大小。 it works fine with all the layouts except for one. 它适用于除一种布局之外的所有布局。

Here is my application.html.erb : 这是我的application.html.erb

<head>
  <title><%= yield(:title).presence || "Krawd" %></title>
  <meta name="description" content="<%= (yield(:description).presence || "").squish %>">

  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <%= favicon_link_tag 'favico.png' %>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <%= stylesheet_link_tag :application, media: "all" %>

  <%= yield(:stylesheets) %>
  <%= csrf_meta_tags %>
</head>
<body>
  <%= render "shared/navbar" %>
  <%= render "shared/flashes" %>
 <!--  <div class="animation-loader padded">
    <span class='loading style-1'></span>
  </div> -->
  <div class="below-navbar">
    <%= yield %>
  </div>


  <%= javascript_include_tag :application %>
  <%= yield(:after_js) %>
</body>
</html>

Here is the layout which does not work : 这是行不通的布局:

<div class="container-fluid bg-grey">   

  <h1>New project</h1>
    <%= render 'form' %>
</div>

thanks, Nathan 谢谢,内森

Try putting the div container-fluid in the application controller layout around the yield statement and take it out of the project model it will then apply to all models. 尝试将div容器流体放在yield语句周围的应用程序控制器布局中,并将其从项目模型中取出,然后将其应用于所有模型。 Just leave the colour CSS there. 只需将颜色CSS保留在那里。

 <body> <dix class = "container-fluid"> # HERE <%= render "shared/navbar" %> <%= render "shared/flashes" %> <!-- <div class="animation-loader padded"> <span class='loading style-1'></span> </div> --> <div class="below-navbar"> <%= yield %> </div> <%= javascript_include_tag :application %> <%= yield(:after_js) %> </div> # HERE </body> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM