为什么我的造型中有未造型的线条?

问题描述 投票:0回答:1

我正试图重现 Tomorrow Night Blue 题材 code-prettify 作为 在此找到. 我有 这把琴. 输出看起来和例子中的完全不一样,每一行都是白色的。它似乎是在应用样式,但不是真的。我有。

<body onload="PR.prettyPrint()">
<pre class="prettyprint linenums lang-html">
    &lt;script type=&quot;text/javascript&quot;&gt;
    // Say hello world until the user starts questioning
    // the meaningfulness of their existence.
    function helloWorld(world) {
      for (var i = 42; --i &gt;= 0;) {
        alert('Hello ' + String(world));
      }
    }
    &lt;/script&gt;
    &lt;style&gt;
    p { color: pink }
    b { color: blue }
    u { color: &quot;umber&quot; }
    &lt;/style&gt;
</pre>
</body>

我到底做错了什么?代码prettify项目 在这里 我以为我是按照这个例子来做的。

javascript html css pretty-print
1个回答
1
投票

问题是在fiddle的css是在js之前,所以一些默认的样式没有被覆盖。我所要做的就是改变顺序。取而代之的是:

<link ...tomorrow-night-blue.css">
<link ...prettify.css">

改为:

<link ...prettify.css">
<link ...tomorrow-night-blue.css">

工作演示: https:/jsfiddle.netbortao79cgrkn4。

© www.soinside.com 2019 - 2024. All rights reserved.