如何防止Blogger将主题样式应用于帖子中的HTML代码段?

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

我正在使用http://hilite.me/来设计代码;但博客覆盖代码颜色以匹配主题'颜色。

例:

<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #0000ff">using</span> Xamarin.Forms;

<span style="color: #0000ff">namespace</span> ExpertsPartners.Controls
{
    <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> <span style="color: #2b91af">CustomLabel</span> : Label
    {
        <span style="color: #0000ff">public</span> CustomLabel()
        {
            TextColor = (Color)Application.Current.Resources[<span style="color: #a31515">&quot;TextColor&quot;</span>];
            FontFamily = (OnPlatform&lt;<span style="color: #2b91af">string</span>&gt;)Application.Current.Resources[<span style="color: #a31515">&quot;TextFont&quot;</span>];
            FontSize = 14;
        }
    }
}
</pre></td></tr></table></div>

但是博客显示了这个:https://buildsucceeded.blogspot.com/2019/03/1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16_16.html

那么有没有办法让博主不将主题颜色应用到帖子中的HTML片段?

html css blogger
1个回答
0
投票

你的CSS工作正常,它是第一个没有用颜色设计样式的包装标签。

编辑:我觉得我应该澄清这一点:你可以通过检查器(开发工具)去计算值,并找到继承值的规则。正如我所回答的,更改那里的继承规则或使用新的规则/内联规则来适当地覆盖样式。

<pre style="margin: 0; line-height: 125%;color:black;">

<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%;color:black;"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #0000ff">using</span> Xamarin.Forms;

<span style="color: #0000ff">namespace</span> ExpertsPartners.Controls
{
    <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> <span style="color: #2b91af">CustomLabel</span> : Label
    {
        <span style="color: #0000ff">public</span> CustomLabel()
        {
            TextColor = (Color)Application.Current.Resources[<span style="color: #a31515">&quot;TextColor&quot;</span>];
            FontFamily = (OnPlatform&lt;<span style="color: #2b91af">string</span>&gt;)Application.Current.Resources[<span style="color: #a31515">&quot;TextFont&quot;</span>];
            FontSize = 14;
        }
    }
}
</pre></td></tr></table></div>
© www.soinside.com 2019 - 2024. All rights reserved.