HallMarc Websites wrote:

Well, I believe Quirks mode is in control here as stated before. In
this case try this:
<div>
  <center>
    <p style="width:600px;"> -- The running text goes here -- </p>
  </center>
</div>
Yes, it's a hack and in Quirks mode Hacking is the way to go
unfortunately. This will center the p element in quirks mode.

The mystic thing is that it also centers it in "Standards Mode". I had to recollect what I have previously found about presentational HTML vs. CSS,
http://www.cs.tut.fi/~jkorpela/html2css.html#al
The align="center" attribute (which is hidden here, since <center>...</center> is just short for <div align="center">...</div>) is defined, in HTML specs, as centering each content line. But browsers additionally center each inner block, like the <p> element here. This violates HTML 4 recommendations, but it corresponds to the description in the HTML5 drafts:
http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#alignment

So despite being a hack that assumes "nonstandard" processing, it appears to be a safe hack.

This is different from using text-align: center in an outer block: while it may work on some old browsers, modern browsers (at least in "Standards Mode") implement the code as per CSS recommendations, i.e. they just center lines, without centering inner blocks. Generally, in "Standards Mode", browsers try to follow CSS recommendations to the letter but may deviate from HTML recommendations (preferring established tradition to the letter of the recommendations).

Please note that in this approach, text lines will be centered in the content of the <center> element, including the inner <p> element. This is usually undesirable, so you may want to use text-align: left for the <p> element. The <p> element itself will still be centered as a block, because it's the outer element's settings that cause that.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to