CSS样式的flash消息 [英] CSS styling of flash message

查看:151
本文介绍了CSS样式的flash消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该在CSS中使用什么样式来设置我的Flash邮件?我似乎不能改变它的造型。以下是我的应用程序布局的< body> 中的相关代码:

What should I use to style my flash messages in my CSS? I can't seem to change it's styling. Here's the relevant code within the <body> of my application layout:

    <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是这样的,但它目前不工作。

The relevant original CSS was something like this but it doesn't currently work.

.error, .alert, .notice, .success, .info {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
.success {background:#e6efc2;color:#264409;border-color:#c6d880;}


推荐答案

为id添加父div的规则:

Either add a rule for parent div with id notice:

#notice {
  css_formatting_here
}

divs:

.flash {
  css_formatting_here
}

错误容器的子div有多个类,以空格分隔。 flash 是其中之一。因此,您可以为该类添加CSS规则,并且它将工作。

The child div of errors container has multiple classes separated by whitespace. flash is one of them. Thus you can add a CSS rule for that class, and it will work.

在这里查看更多此类示例: CSS的隐藏功能

Look here for more such examples: Hidden features of CSS

这篇关于CSS样式的flash消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆