2013-06-01 5:12, Joy Beeson wrote:
> I validated my diary, just for practice. I habitually use an
> almost-blank line
>
> </p><p><center> <!-- *A* -->
> ⁂</center>
> </p><p>
Like most comments, the comment “*A*” is misleading, since the character
used in the content is ASTERISM, “⁂”. This character is really the
problem you should consider: have you specified for it a reasonable list
of font families, containing fonts that have a glyph for it? Cf. to the
list at
http://www.fileformat.info/info/unicode/char/2042/fontsupport.htm
Otherwise, old browsers might even be unable to display it at all.
> Each time these lines
> occur,
validator.w3.org highlights the next-to-the last ">" (That is,
> the second occurrence of </p>) and says
>
>> No p element in scope, but a p end tag seen
That’s because the <center> tag, starting a block-level element,
implicitly closes the open p tag, as if the markup started with
</p><p></p><center>
And this makes the next </p> homeless. The minimal fix is to remove that
</p> tag. A better fix is to use
<p align=center>⁂</p>
though some people say you should used
<p class=divider>⁂</p>
together with a CSS rule like
.divider { text-align: center }
And some Real Purists (like a past version of me) might tell you to use
<hr> and just style it so that it appears as a centered asterism. (It’s
possible by the spec, but perhaps not well enough supported yet by all
those old browsers around.) The reason is that <hr> has always been
defined to denote “change of topic”, even though it is named so that
uneducated people would guess that it means “horizontal rule”. ☺
> Could this be a side effect of putting <center></center> inside a
> paragraph?
In a sense. It’s the effect of trying to put a center element inside a p
element, which is forbidden (by HTML specs) and impossible (browsers
behave like I described, implicitly closing the p element).
> And now the validator contents itself with complaining that <center>
> is obsolete, which bothers me not one whit.
Then why are you using <!doctype html>, which makes the validator apply
HTML5 rules, which express some people’s opinion that presentational
markup like <center> is Evil, Obsolete, and Anathema? If you wish to
keep using such markup, the HTML 4.01 Transitional doctype is a better
choice, probably.
--
Yucca,
http://www.cs.tut.fi/~jkorpela/