Cory Shubert wrote:
> We have a document online and to get it to format correctly when
> printed someone came up with this tag:
> <p style="page-break-after:always"></p>
That's risky, because HTML specs say that authors should not use empty
<p> elements (i.e., <p> elements with empty content) and that browsers
should ignore them, but on the other hand browsers have been observed to
fail to do this and generate some vertical spacing from <p></p>. It is
unclear what "ignored" means - should the style="..." attribute be
ignored, too? Anyway, it is best to assign the style to a nonempty
element - in this case, to the immediately preceding element.
> But I have also seen it in a CSS file like this:
> page-break-before: always;
Well, maybe not quite that, since a page break after _any_ paragraph
would be somewhat odd. But regarding the _correctness_ of the syntax,
which you are asking about (and not really writing style),...
> Is it correct inline to not have the " ; " after always? I always
> thought you had to have it just as in the CSS structure?
No, as CSS specs say, the semicolon is a _separator_ between
This means that when a declaration is not followed by another
declaration, a semicolon is not needed - no matter whether it's in a
style="..." attribute or elsewhere. A semicolon is permitted, however.
Technically it's still a separator then, between the declaration and an
empty declaration. So whether you use it or not _is_ a matter of style,
not a matter of correctness.
If you like, you can always terminate a declaration with a semicolon and
even think that it's an integral part thereof.
Jukka K. Korpela ("Yucca")
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/