如何防止 Blogger 将主题样式应用于帖子中的 HTML 片段?
How to prevent Blogger from applying the theme styling to HTML snippets in posts?
我正在使用 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
那么有没有办法让博主不把主题色应用到post中的一块HTML?
您的 css 正在运行,它是第一个没有使用颜色设置样式的包装标签。
编辑:我觉得我应该澄清一下:您可以通过检查器(开发工具)转到计算值,并找到它从中继承值的规则。
正如我回答的那样,在那里更改继承的规则或使用新的 rule/inline 规则适当地覆盖样式。
<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>
我正在使用 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
那么有没有办法让博主不把主题色应用到post中的一块HTML?
您的 css 正在运行,它是第一个没有使用颜色设置样式的包装标签。
编辑:我觉得我应该澄清一下:您可以通过检查器(开发工具)转到计算值,并找到它从中继承值的规则。 正如我回答的那样,在那里更改继承的规则或使用新的 rule/inline 规则适当地覆盖样式。
<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>