.css problem

.css problem

I'm trying to use .css to set a "text-align" property on a div. What I end up with is a div with style="".

None of the following work:

               $('#testdiv').css({textAlign: 'centered'});
                $('#testdiv').css("text-align", "centered");
                $('#testdiv').attr("style", "text-align:centered;");

If I don't make these calls, firebug shows no "style" attribute. If I do make them, I get a "" style attribute.

What does work is creating a "centered" css class and doing this:

         $('#testdiv').addClass('centered');

What am I doing wrong?