NeTDeMoN wrote:
> 
> the <center> tag is cool because it aligns both inline and block data. Is
> there a way to do a css markup that does the same things as center does?
> 
> I know there is div.centerme {text-align: center} which only works on inline
> data and then there is div.centerme { margin-left: auto; margin-right: auto}
> or whatever for block data. Is there a way to do both at once?

Why not try:

div.centerme { text-align: center;
               margin-left: auto;
               margin-right: auto }

That might not quite work right unless you only have one block-level
item in there. Perhaps something like:

div.centerme { text-align: center }
div.centerme p, div.centerme h1, div.centerme h2,
div.centerme div, div.centerme blockquote, ... {
  margin-left: auto;
  margin-right: auto
}

(replace ... with any other block-level elements that you are interested
in)

That should provide more-or-less the effect you're looking for.

Question to any more advanced CSS hackers - should this instead be:

div.centerme > p, div.centerme > h1...

and if so, why?

Stuart.

Reply via email to