WordPress Auto Wrapping Code

When posting code it wasn’t wrapping text properly on my blog due to how narrow it is. Luckily there’s some easy code that already exists to solve this so reposting it.

height: 120px;
overflow: auto;
font-family: “Consolas”,monospace;
font-size: 9pt;
background-color: #FCF7EC;
overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
margin: 0px 0px 0px 0px;
padding:5px 5px 3px 5px;
white-space : normal; /* crucial for IE 6, maybe 7? */

Hopefully others find this useful.

Leave a Reply

Your email address will not be published. Required fields are marked *