我正在使用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">"TextColor"</span>];
FontFamily = (OnPlatform<<span style="color: #2b91af">string</span>>)Application.Current.Resources[<span style="color: #a31515">"TextFont"</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片段?
你的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">"TextColor"</span>];
FontFamily = (OnPlatform<<span style="color: #2b91af">string</span>>)Application.Current.Resources[<span style="color: #a31515">"TextFont"</span>];
FontSize = 14;
}
}
}
</pre></td></tr></table></div>