Instead of alternating, I would suggest converting consecutive spaces to all except the last one: word_____word -> word _word (so that the browser never wraps before a leading to misalignment).
Or, you could forget entirely and just use <p style="white-space: pre-wrap" /> or <pre style="white-space: pre-wrap" /> to solve the horizontal scrolling problem: <http://www.w3.org/TR/CSS21/text.html#white-space-prop> <http://labnol.blogspot.com/2006/10/html-css-trick-for-displaying-code.html>
Instead of alternating, I would suggest converting consecutive spaces to all except the last one: & nbsp; _word
word_____word -> word
(so that the browser never wraps before a leading to misalignment).
Or, you could forget entirely and just use <p style="white-space: pre-wrap" /> or <pre style="white-space: pre-wrap" /> to solve the horizontal scrolling problem: www.w3. org/TR/ CSS21/text. html#white- space-prop> labnol. blogspot. com/2006/ 10/html- css-trick- for-displaying- code.html>
<http://
<http://