We're trying our hand at HTML4.01 (and CSS3) and from our prior experience in programming we like to pretty print the source code. Example:
<body>
<p>
This is a paragraph in this formatted
document that will render as one
single line.
</p>
</body>
The problem we face is, rendered lines have a trailing whitespace if </p>
isn't right against the last word, such as with the above code:
This is a paragraph in this formatted document that will render as one single line.
(Highlight the text, and a trailing space will appear.)
We've found this to be the case with <a>
and <img>
tags.
Are there any options, not using Javascript, that we can use to prevent this trailing whitespace from appearing, aside from moving closing (and maybe opening) tags to the beginning and end of the actual data?
we initially thought a CSS3 solution but from research it doesn't appear viable this way--all research on it was unsuccessful.
Should be noted that this behavior seems to be unique to Firefox and would only involve their text higlighter, my Chrome and Safari don't render the extra white space, my Firefox doesn't include it in the copied text.
Anyway, one way to not have this extra white space in Firefox is to place a comment right after your text node, before the new line:
<body>
<p>
This is a paragraph in this formatted
document that will render as one
single line.
</p>
<p>
This is a paragraph in this formatted
document that will render as one
single line.<!-- no white space -->
</p>
<p>
This is a paragraph in this formatted
document that will render as one
single line.<!---->
</p>
</body>