2

我正在寻找使用 css 来定位 wordpress 语法 highliter 来更改默认字体大小,我无法向 div 添加任何有用的 css 类,而且如果不全局定位所有 div,我似乎无法定位它!

这是从 g-chrome 开始的完整 css 路径,从自动生成的 div 一直到代码。

 div#"individual-ID-for-each-code-example-here".syntaxhighliter div.lines div.line.alt1 table tbody tr td.content code.string

我已经尝试针对 .syntaxhighliter 和所有其他人,包括没有运气的 pre,我在这里缺少一些简单的东西吗?

这是html:

<pre class="brush: php; title: ; notranslate" title="">

<!--CODE GOES HERE-->

</pre>

如果有帮助,这里是页面本身:

http://msc-media.co.uk/blog/

4

2 回答 2

2

使用这种方式有什么问题:

.syntaxhighliter table tbody tr .code code.string {
    font-size: 12pt !important;
}

截屏

语法高亮

全图在这里...

于 2012-10-07T14:30:54.753 回答
2

感谢 Praveen Kumar 的贡献,但指向的 .css 文件只会更改默认主题的字体大小,如果我将来选择交换主题,字体大小会恢复原状。

我更改了 shCore.css 中的字体大小,因为这将适用于所有主题模板。(语法高亮 2 中的第 56 行)。

CSS提到:

.syntaxhighlighter,
.syntaxhighlighter div,
.syntaxhighlighter code,
.syntaxhighlighter table,
.syntaxhighlighter table td,
.syntaxhighlighter table tr,
.syntaxhighlighter table tbody
{
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    background: none !important;
    text-align: left !important;
    float: none !important;
    vertical-align: baseline !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    height: auto !important;
    width: auto !important;
    line-height: 1.1em !important;
    font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
    font-weight: normal !important;
    font-style: normal !important;

    font-size: 0.98em !important; <- This! (Reduced from 1em, surprisingly this was enough)

    /*min-height: inherit !important; *//* For IE8, FF & WebKit */
    /*min-height: auto !important;*/ /* For IE7 */
    direction: ltr !important;
}
于 2012-10-07T17:06:15.250 回答