On 27/03/2011 6:48 PM, Jukka K. Korpela wrote:
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).
What bothers me with this is that the true IE7 centered blocks by adding
text-align; center to the parent. What version of IE are you checking in
Geoff?
In IE6 and IE7 the following HTML with comment throws both these
browsers into quirks mode.
<!-- -->
<!DOCTYPE html>
<div style="width:600px;border:10px solid blue;margin:0 auto;">
<div style="float:left; background:lime">float</div>
</div>
In IE7 mode in IE9, the above block is centered by the horizontal auto
margins and the float is contained. The true IE7 would also have the
block on the left.
--
Alan http://css-class.com/
Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
______________________________________________________________________
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/