在网站上重新加载我的字体

时间:2011-07-18 08:09:05

标签: asp.net html caching client-side custom-font

我们在网站上使用了一些非基本字体,但问题是重新加载 - 你可以看到基本字体,然后在每一页上重新加载到我们的字体。它可能缓存它或以某种方式将其保存到客户端?重新加载每一页都很糟糕。

网址:http://ktwebstudio.cz/

我们正在使用Windows托管和ASP.NET。

我找到了它:

<system.webServer>
    <staticContent>
        <clientCache cacheControlMode="UseMaxAge" />
    </staticContent>
</system.webServer>

一切都很好。

2 个答案:

答案 0 :(得分:0)

如果您在网页上使用自定义字体是您的意思,那么CSS是最好的方法。它运作得很好,我可以从个人经验告诉你。这是你如何做到的:

注意:

  • 您可以使用下面的示例定义任意数量的自定义字体。
  • Internet Explorer使用EOT字体而不是TTF。
  • 使用您指定的font-family在网页中使用该字体。

    @font-face
    {
        font-family: name_of_font;
        src: 
            url('url of name_of_font.ttf' */), 
            url('url of name_of_font.eot' */);
    }
    


示例:

<p style="font-family: name_of_font; font-size: 100%;"> Your text here with the custom font you specified... </p>

答案 1 :(得分:0)

即使字体被缓存,也不可能停止将基本字体重新加载到嵌入式CSS3字体中!这是一个Web浏览器问题。有些网络浏览器会这样做(Opera),有些则不这样做(IE9)。

相关问题