IE6 では、空の段落に続く段落が空の段落の背景色で表示されますが、これは間違っていると思います! Firefox では正常に動作しますが、IE7 は確認していません。
この問題に対する CSS ソリューションはありますか、それとも空の要素を削除する必要がありますか?
(空の要素を削除する必要はありません。出力する前にすべての要素が空かどうかをチェックするコードを書く必要があるためです)
厳密なまたは移行的なDoctypeを使用しても、動作は変更されません(回答に応じてこのコメントを追加しました)
興味深いことに、この効果はテキストの色では発生せず、背景色のみで発生します。
<html>
<head>
</head>
<body>
<p style='background-color:green'>Green content</p>
<p style='background-color:red'>Red content</p>
<p>Unstyled background working because previous red element is not empty</p>
<p style='background-color:green'>Green content</p>
<p style='background-color:red'></p>
<p>Unstyled background broken because previous red element is empty</p>
<p style='color:green'>Green content</p>
<p style='color:red'>Red content</p>
<p>Unstyled text color working because previous red element is not empty</p>
<p style='color:green'>Green content</p>
<p style='color:red'></p>
<p>Unstyled text color working even though previous red element is empty</p>
</body>
</html>