WordPress Preformatted Word Wrapping?

For most of my posts I use the “Preformatted” style from the drop down menu in the Visual editor of WordPress. It works quite well for demonstrating sections of code or screen output. However, there is a problem with using Preformatted and that is the issue with word wrapping.

Preformatted style in WordPress uses the <pre> HTML tag. The <pre> tag does not word wrap any of the sentences contained within, and if you are using a defined space for displaying the text, as with the theme on my WordPress, you may find that your examples are shortened. Fortunately there is a fix to this problem that requires some minor style tag modifications for the <pre> tags that seem to run off into the distance.

I found a blog post on techguy.org that helped me out…quickly to the point, add:

white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;

to your <pre style=”"> tag and the text should wrap in most browsers.

http://forums.techguy.org/web-design-development/249849-forcing-long-text-lines-wrap.html

I’m out…

Tags: , ,

About aaron

IT is not just a job but also a passion. Everything I have accomplished, both personally and professionally, has been generally entertaining, bordering on fun. Some of my projects, such as working with SharePoint Services workflow actions in Visual Studio or building a custom iSCSI SAN using the OpenSolaris, ZFS and COMSTAR, has been quite rewarding. You may think nerd...I think developing a new trend!