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>
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;}
If you need to show a flash message without a trigger element (e.g., you want to show the message as a consequence of user actions), you can use the ' showFlashMessage ' custom event.
Click on the empty space of the Dynaform to display its properties on the left side of the screen. Then, click on the "edit" button in the javascript property. } ); Now, run the case, click on the "Show message" button and the flash message will be displayed in front of the Checkgroup element.
What are flash messages? A flash message is a way to communicate information with the users of your Rails application so they can know what happens as a result of their actions. Example messages: “Password changed correctly” (confirmation)
Either add a rule for parent div with id notice:
#notice {
css_formatting_here
}
Or add a rule for child divs:
.flash {
css_formatting_here
}
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.
Look here for more such examples: Hidden features of CSS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With