flash CSS styling

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!

Thanks for the try...

I probably should have been more specific. In all cases there is not
enough text in the flash/div to wrap over more than one line. So what
I really want is to automagically size the horizontal to match the
contents and center the box. Alas there is no float: center.

To clarify:

*the div (and thus the box made by outline:) is always centered.
*when the contents of the div are "blah, blah." I want the box to be
just big enough to fit "blah, blah." but when the contnts are "blah,
blah, blah. Blah, blah, blah, blah blah." I want the box to be just
big enough to fit those contents.
*the div is always never more than row of text, in fact, I don't
currently set height or width, which results in the div filling the
width of its container.

Woe for a overflow: expand; option.

---A