我應該使用什麼來在CSS中設置我的Flash消息樣式?我似乎無法改變它的造型。這裏是我的應用程序佈局的<body>
中的相關代碼:Flash格式的CSS樣式
<div class="container">
<%= render 'layouts/header' %>
<section class="round">
<div id= "notice">
<% flash.each do |key, value| %>
<div class="flash <%= key %>">
<%= value %>
</div>
<% end %>
</div>
<%= yield %>
</section>
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>
</div>
相關的原始CSS是這樣的,但目前沒有工作。
.error, .alert, .notice, .success, .info {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
.success {background:#e6efc2;color:#264409;border-color:#c6d880;}
什麼是CSS樣?什麼是生成的HTML輸出? – NullUserException 2011-03-04 05:37:50
發佈了CSS ... – 2011-03-04 05:44:03
對於您正在使用的HTML和CSS,這應該起作用。你確定你的頭文件中包含CSS文件嗎?如果是Rails教程,你應該在你的佈局中將'layout'/ stylesheets''渲染得更遠一些,它應該有'stylesheet_link_tag'blueprint/screen',:media =>'screen''(在'應用程序/視圖/佈局/ _stylesheets.html.erb')。見[這裏](https://github.com/BinaryMuse/rails-book/blob/master/app/views/layouts/application.html.haml#L8)和[這裏](https://github.com/ BinaryMuse/rails-book/blob/master/app/views/layouts/_stylesheets.html.haml)(儘管我使用的是Haml)。 – 2011-03-04 05:50:26