Centering children of a div without using <center>
The center
tag is deprecated. I should not use it anymore. However, I haven't been able to reproduce the following with using center
:
<div><center><span>Test<span> <span>Test<span> <span>Test<span></center></div开发者_运维百科>
I have tried using margin: 0 auto
and align: center
but both don't work: http://jsfiddle.net/zTY4f/
margin: 0 auto
works if you explicitly set a width as well.
div {
width: 400px;
margin: 0 auto;
}
use css:
div {
text-align:center;
}
精彩评论