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

时间:2019-03-16 20:13:31

标签: html css blogger

我正在使用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?

1 个答案:

答案 0 :(得分:0)

您的CSS正在运行,这是第一个没有用颜色设置样式的包装标签。

编辑:我觉得我应该澄清一下:您可以通过检查器(开发工具)进入计算值,并找到其继承值的规则。 正如我回答的那样,在此处更改继承的规则或使用新的规则/内联规则适当地覆盖样式。

char

#include <stdio.h>
#include <limits.h>
#include <ctype.h>

#define QUAD  4u    /* if you need a constant, #define one (or more) */
#define QBYTES 8u

/** binary representation of 'v' padded to 'sz' bits.
 *  the padding amount is limited to the number of
 *  bits in 'v'. valid range: 1 - sizeof v * CHAR_BIT.
 */
void binprnpad (const unsigned long v, size_t sz)
{
    if (!sz) { fprintf (stderr, "error: invalid sz.\n"); return; }
    if (!v)  { while (sz--) putchar ('0'); return; }

    if (sz > sizeof v * CHAR_BIT)
        sz = sizeof v * CHAR_BIT;

    while (sz--)
        putchar ((v >> sz & 1) ? '1' : '0');
}

int main (void) {

    unsigned ndx = 0;   /* index of the hex byte read */

    fputs ("enter hex IP: ", stdout);   /* read/validate input */

    while (ndx < QBYTES) {  /* read until 8 hex bytes read */
        unsigned char c = toupper(getchar());   /* read char as upper-case */
        if (isdigit (c)) {                      /* if [0-9] */
            binprnpad (c - '0', QUAD);
            ndx++;
        }
        else if (isxdigit (c)) {                /* if [A-F] */
            binprnpad (c - '7', QUAD);
            ndx++;
        }
        else if (c == '.')                      /* if '.' */
            putchar (c);
        else {      /* handle character not [0-9A-F.] */
            fputs ("(error: invalid character input)\n", stderr);
            break;
        }
    }
    putchar ('\n');     /* tidy up with newline */

    return 0;
}