Bootstrap: center any span
alignment, css, html, twitter-bootstrap
Solution
As of Bootstrap 2.3.0 you can use the built in class `.text-center`.
<div class="row-fluid">
<div class="span12 text-center">
My content to be centered here
</div>
</div>
It worked perfectly for me... :)
Problem
I have a problem when using a class to center my `span` : ``` .center { float:none; margin-left: auto; margin-right: auto; } <div class="row-fluid"> <div class="center span5"> <button></button> </div> </div> ``` This does not work, apparently it is overridden by bootstrap row-* CSS. However if I include the same style in the div directly (`style="..."`) it works. I think it doesn't work because it doesn't knows the width, so I tried to use an offset, but then when the button isn't centered as well as with the .CSS. I can't specify a width since my `button` width is set by external JavaScript. How can I make the .center class work in that case?