Q:

text-align:center and short floated divs

I have an html file which looks something like this:
<div style="float:right">
A line of text, floating to the right
</div>
<div style="text-align:center">
And here, several lines of<br />
text which I want to center.
</div>

Which renders (at least in Firefox) like this:

    And here, several lines of       A line of text, floating to the right
                         text which I want to center.

What I want is for the text in the second div to be centered around a single vertical axis, unaffected by the height of the floated div to the right:

     And here, several lines of     A line of text, floating to the right
    text which I want to center.

Now, what makes this a problem is that I cannot change the floating div; I only control the second div with the text that I want to center. Furthermore, I do not necessarily know the floated div's width and height. I cannot use javascript. I cannot use absolute positioning because I don't have any control over the parent blocks, and I don't know which of them have non-static positioning. And I really don't want to use a table, unless there is no other alternative.
Is there a way to do this?

A:

Set the width of the centered div to 50% and use margin:0 auto to center it. 
   <div style="float:right">
        A line of text, floating to the right
    </div>
    <div style="width:50%;margin:0 auto;text-align:center">
        And here, several lines of<br />
        text which I want to center.
    </div>

Depending on the length of your text, you may have to adjust with the width %.

