I also make sure that inter-line and inter-paragraph spacing are set right. What I do is create a paragraph style (perhaps called ' Code Example' or something like that) which uses a monospaced font, carefully chosen tabs, a very light grey background, a thin black border above and below (that helps visibility a lot) and with spelling turned off.
When I've done this, I've made extensive use of styles.