Nikolaos Giannopoulos wrote:
text-align: center when applied to a block will center all elements
contained in the block e.g. to center an img wrap it in a div and
apply text-align: center to the div.
Just so that the op is clear:
text-align: center when applied to a block level element will center
all elements contained in it *in MSIE/Win only*[1]. In conforming
browsers, text-align: center will center only inline content in a block.
div {text-align: center; border: thin solid black }
p {border: thin solid green }
p.narrow {width: 12em; border: thin solid blue }
<div>
this text is centered within the div
<p>
this text is centered within the p by inheritance, but
the p element itself is not centered in e.g. Mozilla
</p>
<p class="narrow">
this text is centered within the p by inheritance, but
the p element itself is not centered in e.g. Mozilla
</p>
</div>
[1]I don't have MSIE 6, and am not sure about its behavior. I think
in standards mode, it behaves like Mozilla and Opera on this matter,
but in quirks mode it emulates the bugs of MSIE 5.x/Win. Also, there
are other older browsers that may also suffer from this bug.
--
Brian
follow the directions in my address to email me