我似乎找不到哪里不对劲。我有这个html文件与谷歌美容使用。prettify.css和prettify.js都与html文件位于同一目录中
<html>
<head>
<script src="prettify.js"></script>
<link rel=StyleSheet href="prettify.css" type="text/css">
</head>
<body>
<pre class="prettyprint">
//Some sample text
for(int i = 0; i<10; i++){
//Do something
}
</pre>
</body>
</html>这是它看起来的样子

要显示这些颜色,我错过了什么?
谢谢
发布于 2012-09-20 12:57:20
将onload="prettyPrint()"添加到文档的body标记中。
<body onload="prettyPrint()">发布于 2017-11-26 02:13:56
下面是将进行适当语法突出显示的代码
<html>
<head>
<!--<script src="prettify.js"></script>I commented out your links-->
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
<!--<link rel=StyleSheet href="prettify.css" type="text/css"> I commented out your links-->
</head>
<body>
<pre class="prettyprint">
//Some sample text
for(int i = 0; i<10; i++){
//Do something
}
</pre>
</body>
</html>https://stackoverflow.com/questions/12506244
复制相似问题