Tuesday, November 9, 2010

Fixing Code Format

Just noticed that my code examples were not showing properly in Firefox.


The fix was simple. Added the following css property -
white-spacenormal;

However now IE was not happy -


The correct property in this case was -
white-spacepre-wrap;

With “white-space:pre-wrap”, it's like mix of “pre”, and “normal”.
- Repeated spaces are shrinked into just one space.
- Newline char will force a wrap.
- Very long lines will be automatically wrapped too, by the element's width.

I found the information at xahlee useful when fixing this style issue.

No comments: