Tuesday, May 6, 2014

Wrap code lines in PRE tag in Blogger

Sometimes the code line is too long to fit in <pre> tag in Blogger blogs, we can use below method to wrap the code lines.
  1. Click "Template":

  2. Click "Customize": 
  3. Click "Advanced"=>"Add CSS"
    Enter below content:
pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
}
Here is the effect:

2 comments:

Popular Posts