Forum: Ruby on Rails CSS for flash messages

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Matthew F. (Guest)
on 2006-05-03 03:05
Hello all,

I'm perplexed by the following:

I've implemented flash messages in my application.rhtml with:

<% for name in [:notice, :warning, :message] %>
  <% if flash[name] %>
    <%= "<p id=\"#{name}\" class=\"flash\">#{flash[name]}</p>" %>
  <% end %>
<% end %>

I've implemented CSS in application.rhtml with:

<%= stylesheet_link_tag "avcnotes" %>

Now, each of these things works--my flash messages appear when they
should, and my styles are applied to all the pertinent elements...EXCEPT
flash messages.  In avcnotes.css I have (among other things):

.notice {
color:yellow
}
.warning {
color:red
}
.message {
color:yellow
}
#flash {
border:1px solid black;
width:100%;
text-align:center
}

No matter what I've tried, these styles are not applied to my flash
messages.  Is there a step/trick/hack I'm missing here?

Thanks in advance,

-ELf
Jeff C. (Guest)
on 2006-05-03 14:08
Matthew F. wrote:
> Hello all,

> Now, each of these things works--my flash messages appear when they
> should, and my styles are applied to all the pertinent elements...EXCEPT
> flash messages.  In avcnotes.css I have (among other things):
>
> .notice {
> color:yellow
> }
> .warning {
> color:red
> }
> .message {
> color:yellow
> }
> #flash {
> border:1px solid black;
> width:100%;
> text-align:center
> }
>
> No matter what I've tried, these styles are not applied to my flash
> messages.  Is there a step/trick/hack I'm missing here?

You've got your signifiers switched.  # is the code for "id" and . is
the code for "class".

#notice

#warning

#message

and

.flash

Jeff C.man
Nick Wientge (Guest)
on 2006-05-03 21:05
(Received via mailing list)
you've got your id's and classes backwards...
Matthew F. (Guest)
on 2006-05-03 23:43
Jeff C.man wrote:

> You've got your signifiers switched.  # is the code for "id" and . is
> the code for "class".

Well, don't I feel silly.

Many thanks, gentlemen!

-ELf
This topic is locked and can not be replied to.