发现prettify不能显示行号,于是上网找了解决方法:

只使用prettify的js的文件,不使用css文件,另外添加这段css

 .com { color: #93a1a1; }
.lit { color: #195f91; }
.pun, .opn, .clo { color: #93a1a1; }
.fun { color: #dc322f; }
.str, .atv { color: #D14; }
.kwd, .linenums .tag { color: #1e347b; }
.typ, .atn, .dec, .var { color: teal; }
.pln { color: #48484c; } .prettyprint {
padding: 8px;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
}
.prettyprint.linenums {
-webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
-moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
} /* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin: 0 0 0 33px; /* IE indents via margin-left */
}
ol.linenums li {
padding-left: 12px;
color: #bebec5;
line-height: 18px;
text-shadow: 0 1px 0 #fff;
}

这里bootstrap使用2.3.2的

完整代码:

 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="bootstrap/css/bootstrap.css" /> <!--[if lt IE 9] >
<script type="text/javascript" src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>bootstrap</title>
<style>
body { } @media ( max-width :767px) {
body {
background: #ccc;
}
}
.com { color: #93a1a1; }
.lit { color: #195f91; }
.pun, .opn, .clo { color: #93a1a1; }
.fun { color: #dc322f; }
.str, .atv { color: #D14; }
.kwd, .linenums .tag { color: #1e347b; }
.typ, .atn, .dec, .var { color: teal; }
.pln { color: #48484c; } .prettyprint {
padding: 8px;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
}
.prettyprint.linenums {
-webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
-moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
} /* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin: 0 0 0 33px; /* IE indents via margin-left */
}
ol.linenums li {
padding-left: 12px;
color: #bebec5;
line-height: 18px;
text-shadow: 0 1px 0 #fff;
}
</style>
</head>
<body onload="prettyPrint()">
<div class="container">
<h1 class="page-header">
练习<small>bootstrap</small>
</h1>
<div class="row">
<pre class="prettyprint linenums">
&lt;div class=&quot;span4&quot;&gt;
&lt;h2 class=&quot;page-header&quot;&gt;练习bootstrap&lt;/h2&gt;
&lt;p&gt;123213123213231&lt;/p&gt;
&lt;/div&gt;
</pre>
</div>
</div>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="google-prettify/prettify.js"></script>
</body>
</html>

效果:

bootstrap结合google code prettify的问题的更多相关文章

  1. 五、Google Code Prettify:实现代码高亮的JS库

    介绍 code prettify 解释为 “代码修饰”. 他由JS代码和CSS代码构成,用来高亮显示HTML页面中的代码. 支持:C, Java, Python, Bash, HTML, XML, J ...

  2. 使用 Google Code Prettify 实现代码高亮

    今天这篇文章主要讲述使用 google-code-prettify 来实现代码的高亮显示,以前我使用 highlight.js 来实现文章中代码的高亮显示. prettify 非常小巧且配置简单,使用 ...

  3. Google Code Pretiffy 代码 着色 高亮 开源 javascript(JS)库

    1.简介 introduction Google Code Pretiffy 是 Google 的一个用来对代码进行语法着色的 JavaScript 库,支持 C/C++, Java, Python, ...

  4. bootstrap之google fonts

    bootstrap之google fonts 在学习一个bootstrap时,看到了一行引用代码:@import url(http://fonts.googleapis.com/css?family= ...

  5. svn import 向Google code里导入初始代码

    其实很简单的问题,花费了这么多时间,想把初始代码导入到Google code里,用VisaulSVN插件的Switch功能也不可以,Google code上虽然有上传,但是只能单个文件传...... ...

  6. 使用Google Code和客户端TortoiseSVN 工具搭建一个在线源代码版本控制系统

    把代码放在Google Code里,客户端还是使用TortoiseSVN ,就可以很方便地在家里和办公室协调工作了,不用再用U盘把代码拷来拷去了. 搭建过程: 1.注册一个google账户:https ...

  7. Google code: Why ‘Everything up-to-date’ when pushing (git)

    原文链接:http://blog.rexzhao.com/2011/11/28/google-code-git-everything-up-to-date-when-push.html 第一次在Goo ...

  8. google code 上传源码

    在使用google code 的时候 做个备份, git clone https://wushuangzilong@code.google.com/p/maplebanana-proxy/ git c ...

  9. Google Code项目代码托管网站上Git版本控制系统使用简明教程

    作为一个著名的在线项目代码托管网站,Google Code目前主要支持三种版本控制系统,分别为Git, Mercurial和 Subversion.Subversion即SVN相信大家都已经熟知了,这 ...

随机推荐

  1. tp框架--------where("1")

    今天看代码的时候看到一个令我难以理解的sql查询语句,这是tp框架里的 return $this->where("1")->order('ar_id desc')-&g ...

  2. watch监听

    watch: { getTitle:{ handler:function(val,oldval){ }, deep:true//对象内部的属性监听,也叫深度监听 }, },

  3. TP框架传值

    /*TP框架传值*/ location.href = "../add/add/department/"+department+"/username/"+user ...

  4. 如何发布到NPM上(转)

    简要:这篇文章介绍了如何讲自己的包发布到NPM上,马克一下,将来有用 ... npm包发布 发布npm包,更方便以后下载使用. 我们已经把插件代码上传到github上面了,那么我们是否可以也做成一个n ...

  5. NodeJS学习笔记 (3)域名解析-dns(ok)

    域名解析:dns.lookup() 比如我们要查询域名 www.qq.com 对应的ip,可以通过 dns.lookup() . var dns = require('dns'); dns.looku ...

  6. NOIp2018模拟赛三十三

    神奇的一场... 成绩:100+0+14=114 A题是个体面很恐怖的题...然而看懂题意之后转化一下就变成了一道暴力傻逼题...但是不知道为什么dalao们都没写,讲题的时候挺尴尬的...yrx“瞄 ...

  7. python中的try...except...finally函数

    异常Error 我们在写代码的时候,经常会遇见程序抛出Error无法执行的情况 一般情况下,在Python无法正常处理程序时就会发生一个异常.异常是Python对象,表示一个错误.当Python脚本发 ...

  8. MongoDB学习笔记&lt;七&gt;

    继续MongoDB的学习 1.导出数据(中断其它操作) 把数据库test中的books集合导出 在终端下进行操作 mongoexport -d test -c books -o /home/hadoo ...

  9. 一入python深似海--python之道

    python社区不乏幽默.先来看"python之道"这首诗. 导入this包: import this 输出是一首诗,这首诗总结了Python的风格,能够指导Python程序猿的编 ...

  10. HP-lefthand底层结构具体解释及存储灾难数据恢复

    HP-lefthand底层结构具体解释及存储灾难数据恢复 一.HP-lefthand的特点 HP-lefhand是一款很不错的SAN存储,使用iscsi协议为client分配空间. 它支持RAID5. ...