分类文章

热门文章

WP-Syntaxs 代码自动换行问题

WP-Syntaxs 是一个代码高亮插件,使用简单,支持多种语言
但它并不是完美的,WP-Syntaxs 对代码不能够支持自动换行,如果你加入的代码很长的话它会将页面拉的很长。
在网上找了很多解决的办法,但都存在一定的缺陷

方法一:修改插件目录下wp-syntax.css文件,将.wp_syntax table 中的内容替换如下

.wp_syntax table {
   table-layout:fixed;
  overflow:hidden;
  text-overflow:ellipsis;
  word-break: break-all;
  word-wrap: break-word;
}

缺点 只有在代码中加入行号后才会自动换行,但效果不尽如人意
wp-syntax

方法二:修改插件目录下wp-syntax.css文件,将.wp_syntax pre替换成下面的内容

.wp_syntax pre {
  margin: 0;
  width: auto;
  float: none;
  clear: none;
  overflow: visible;
  font-size: 12px;
  line-height: 1.333;
 
  white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap;  /* 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+ */
 
}

该方法在不加行号的时候能够实现代码自动换行,加上行号的话就不行了,看来要用wp-syntax的话也只有这样凑活了
更多 内容可查看 http://users.tkk.fi/~tkarvine/pre-wrap-css3-mozilla-opera-ie.html

随机文章



分享生活也赚钱,赶快加入吧

Loading…

相关文章:

  1. javascript压缩工具 jsmin
  2. WordPress WP-Syntax插件

请给本文打分   
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.00 out of 5)
Loading ... Loading ...

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word