I realize this is a CSS question, and not a rails question, so forgive the off-topicness, but I thought rails users might have some experience with this...
In my app I typically set one of two flash messages to inform users on the sucess/failure of their actions. Ethier flash[:message] or flash[:error] will be set. I want this to appear in the same place as part of my site layout every time, so in my layouts/application.rhtml I have an "if flash[:message]..." and an "if flash[:error]..." just before my yield. I set CSS styles on them differently, message has a green box border and green text, error is red, both are centered, so on and so forth.
The problem is that I always have different size text in those boxes, and so I can't set the size of the div accuratley. Sometimes I have two or three words, in which case I have a lot of whitespace inside the box. If I make the box small then when I have longer flash text most browsers won't expand the div to fit the text.
Anyone run into this design issue before and know how to fix it? I suppose in application.rhtml I could do a character count of the flash and then size the div accordingly as part of the div tag, leaving all size info out of my stylesheet, but that seems like a little more math than I would prefer in a view.
Thanks!