Html @嵌入在aspx文件中的字体不起作用

Html @嵌入在aspx文件中的字体不起作用,html,css,asp.net,iis,fonts,Html,Css,Asp.net,Iis,Fonts,我试图在我的网站上使用一些有趣的字体。但不知何故,由于某种原因,字体无法加载或无法工作 我有一个母版页,其中有2个标签。一个在头部部分用于类似用途,如使用外部字体,另一个在正文部分 我试过两件事: 1)提供存储在我的visual studio上的字体url的文件 2)其他提供我的文件系统的url 这是我的HTML文件: <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"> <styl

我试图在我的网站上使用一些有趣的字体。但不知何故,由于某种原因,字体无法加载或无法工作

我有一个母版页,其中有2个
标签。一个在头部部分用于类似用途,如使用外部字体,另一个在正文部分

我试过两件事:

1)提供存储在我的visual studio上的字体url的文件

2)其他提供我的文件系统的url

这是我的HTML文件:

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        @font-face{
            font-family:Junction;
            src : url("http:localhost:63183/fonts/Junction.otf") format('opentype');
        }
        @font-face{
            font-family:chunkfive;
            font-weight:bold;
            src : url("f:\practicals7th sem\project docs\templates\temp1\chunkfive.otf") format('opentype');
        }

    </style>
</asp:Content>

@字体{
字体系列:joint;
src:url(“http:localhost:63183/fonts/Junction.otf”)格式(“opentype”);
}
@字体{
字体系列:chunkfive;
字体大小:粗体;
src:url(“f:\practicals7th sem\project docs\templates\temp1\chunkfive.otf”)格式(“opentype”);
}
以下是我的正文部分内容:

<div style="text-align: center; font-family:'Junction.otf' ; font-size: 20px; color: #db2828">
                            <%# Eval("Name") %>


404错误,但用于不同的引导文件。“>

您需要在IIS中设置MIMETYPE:

<system.webServer>
    <staticContent>
        <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
        <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
        <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
        <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
        <mimeMap fileExtension=".otf" mimeType="font/opentype" />
    </staticContent>
</system.webServer>

添加此项会使渲染的HTML看起来像一个骨架。我不知道为什么,但这不起作用。您是否在
/font
文件夹中获得文件?是否获得404?是的,我在visual studio的
服务器资源管理器中获得了
/font
文件夹。我应该在哪里获得404?@AbhishekGhosh更新mime类型。请重试请检查我添加的屏幕截图。你可以看到这个关于字体渲染不正确的线程。
 @font-face{
            font-family:Junction;
            src : url("/fonts/Junction.otf") format('opentype');
        }
        @font-face{
            font-family:chunkfive;
            font-weight:bold;
            src : url("/fonts/chunkfive.otf") format('opentype');
        }