发现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. QT笔记 -- (2) 文件相关操作、中文路径乱码

    1.显示文件对话框,选择一个目录,显示选中目录中的所有图片的代码如下 主要class: QFileDialog QStringList QFileInfoList QDir void open(){ ...

  2. shell-4.bash的变量:用户自定义变量

    目录 内容

  3. CentOS 6.9 CentOS 7.4 自动安装系统 kickstart

    通过ks文件 实现 CentOS 6.9 & 7.4 自动安装系统 环境: VMware 14.0 Pro版 光盘镜像: CentOS-6.9-x86_64-minimal.iso ks文件生 ...

  4. 联想E490 加M.2固态硬盘 卡在第一画面不动解决办法

    电脑配置:  E490  500G机械硬盘,自己加M.2 NVMe 固态硬盘. 问题:启动时出现 2101:Detection error on SSD1(M.2),  无法识别到机械硬盘 (重新插拨 ...

  5. 织梦dedecms支持flash的flv文件播放功能代码

    1.打开/include/FCKeditor/editor/dialog/dede_media.htm if(playtype=="rm"|| (playtype=="- ...

  6. 二进制与十进制的转化,bool str int 之间的转化,str的常用操作,

    1.基础数据类型总览(7种) int: 整型,用于进行+-*/运算 str: 存储少量的数据;可加str,可乘数字,可切片,可进行9种常用操作 bool: True False 判断真假 list: ...

  7. Linux 添加挂载硬盘(包含挂载大于2T以上硬盘)

    转自:http://blog.csdn.net/season_hangzhou/article/details/36423223 由于事先规划问题或者业务需求量激增,总会出现机器硬盘空间不够用的情况 ...

  8. react-native 编译报错: undefined is not an object (evaluating '_react2.PropTypes.func')

    情况通报: 因为是我的二维码模块报错,提示报错代码如下 重要信息是下面的红色字体部分(Android 模拟器红屏) undefined is not an object (evaluating '_r ...

  9. CSS 子元素选择器

    所有选择器参考手册:http://www.w3school.com.cn/cssref/css_selectors.asp 1)子元素选择器 参考链接:http://www.w3school.com. ...

  10. HDU——T 1150 Machine Schedule

    http://acm.hdu.edu.cn/showproblem.php?pid=1150 Time Limit: 2000/1000 MS (Java/Others)    Memory Limi ...